Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk3 min

Building a Restaurant Website: Styling the HTML Project with CSS (Part 3)

Part 3 moves the restaurant website project from HTML structure to CSS styling, with practical guidance on selectors, properties, stylesheet placement and image URLs.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Part 3 of Dilesh Zingare’s beginner restaurant-website project series moves from the HTML-based page to CSS styling. The tutorial introduces selectors and properties such as color, background-color, text-align, padding, text-decoration and font-family; despite the series title, this is not a page styled with HTML alone. Read Part 3.

What Part 3 adds to the project

HTML provides the page structure; CSS controls its presentation. In this installment, the restaurant webpage gets styling through rules that target elements such as body and header. A selector identifies what to style, and declarations specify property/value pairs—for example, a color or background color.

As an Amazon Associate I earn from qualifying purchases.

The tutorial keeps the CSS in the HTML file, a convenient arrangement for a small one-page exercise. The same rules can instead live in a separate stylesheet. MDN describes external, internal and inline CSS as the three common ways to apply styles, and identifies external stylesheets as the most common and useful approach. MDN’s CSS getting-started guide explains the options.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose where the CSS belongs

Approach How it is applied Useful when
Internal stylesheet Rules go inside a <style> element in the document’s <head>. You want a small exercise’s HTML and CSS together, or cannot modify external files.
External stylesheet A <link rel="stylesheet" href="styles.css"> element in the document head connects a separate file. You want to reuse styles across pages or keep structure and styling in separate files. If the stylesheet is in a subdirectory, adjust the href path.
Inline style CSS is written on an individual HTML element. You need a style attached directly to one element; for a site-wide design, it is less convenient to maintain than a stylesheet.

Read a CSS rule

A basic rule has a selector followed by a block of declarations. For example, this illustrative rule targets the page body and sets two properties:

body {
  color: #222;
  background-color: #fff;
}

body is the selector. Inside the braces, each declaration pairs a property with a value: color sets text color, while background-color sets the background color. The Part 3 tutorial also introduces text-align for horizontal text alignment, padding for space inside an element, text-decoration for text decoration, and font-family for the typeface.

Use a background image URL correctly

A CSS background image can refer to a file in your project with a relative URL, or to an image at an absolute URL. For example, a local image could be written as:

Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option
header {
  background-image: url("images/background.jpg");
}

The path is relative to the stylesheet’s location. If the CSS is inside a subdirectory, the relative path may need to change. CSS also supports data URLs, which embed image data and include their own media-type syntax. A data URL is not a fixed prefix to place in front of an ordinary web address. See MDN on CSS URL values, the url() function and background-image.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use standard properties for alignment

For horizontal alignment of text, use text-align, such as text-align: center;. The tutorial mentions this property; its separate example also includes text-position. Do not rely on text-position as a standard CSS property for the alignment shown there. Use the property that expresses the intended effect.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Continue from the tutorial

This is a beginner project lesson rather than a complete reference to CSS. The tutorial links to a GitHub project reference, but the repository contents are not independently confirmed here. Treat the code and examples as a starting point: add rules incrementally, save the file, and check the rendered page in a browser to see how each property changes the presentation.

Quick Recap

SaleBestseller No. 2
HTML and CSS: Design and Build Websites
HTML and CSS: Design and Build Websites
HTML CSS Design and Build Web Sites; Comes with secure packaging; It can be a gift option
$14.94
SaleBestseller No. 3
SaleBestseller No. 5
Web Design with HTML, CSS, JavaScript and jQuery Set
Web Design with HTML, CSS, JavaScript and jQuery Set
Brand: Wiley; Set of 2 Volumes
$35.05
Best Value
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.