Facebook Pixel
Searching...
English
EnglishEnglish
EspañolSpanish
简体中文Chinese
FrançaisFrench
DeutschGerman
日本語Japanese
PortuguêsPortuguese
ItalianoItalian
한국어Korean
РусскийRussian
NederlandsDutch
العربيةArabic
PolskiPolish
हिन्दीHindi
Tiếng ViệtVietnamese
SvenskaSwedish
ΕλληνικάGreek
TürkçeTurkish
ไทยThai
ČeštinaCzech
RomânăRomanian
MagyarHungarian
УкраїнськаUkrainian
Bahasa IndonesiaIndonesian
DanskDanish
SuomiFinnish
БългарскиBulgarian
עבריתHebrew
NorskNorwegian
HrvatskiCroatian
CatalàCatalan
SlovenčinaSlovak
LietuviųLithuanian
SlovenščinaSlovenian
СрпскиSerbian
EestiEstonian
LatviešuLatvian
فارسیPersian
മലയാളംMalayalam
தமிழ்Tamil
اردوUrdu
HTML and CSS

HTML and CSS

Design and Build Websites
by Jon Duckett 2011 514 pages
4.30
4k+ ratings
Listen
Listen to Summary

Key Takeaways

1. HTML & CSS are the Foundation of Web Design

All websites use HTML and CSS, but content management systems, blogging software, and e-commerce platforms often add a few more technologies into the mix.

Essential Technologies. HTML (HyperText Markup Language) provides the structure and content of web pages, while CSS (Cascading Style Sheets) controls their visual presentation. These two languages are the bedrock of web development, regardless of whether you're building a site from scratch or using a content management system (CMS).

Beyond the Basics. While larger websites may incorporate additional technologies like JavaScript, PHP, or databases, a solid understanding of HTML and CSS remains crucial for anyone working with the web. Designers can create more attractive and usable sites, website editors can create better content, marketers can communicate with their audience more effectively, and managers can commission better sites and get the best out of their teams.

Empowering Control. Mastering HTML and CSS empowers you to take control over the appearance of your website, regardless of the platform you use. Whether you're tweaking a template or building a custom design, these skills are essential for creating a professional and engaging online presence.

2. Structure Web Pages with HTML Elements

To describe the structure of a web page, we add code to the words we want to appear on the page.

Describing Content. HTML uses elements, denoted by tags enclosed in angle brackets (e.g., <h1>, <p>), to define the different parts of a web page. These elements tell the browser how to display the content, such as headings, paragraphs, lists, and images.

Common HTML Elements:

  • <html>: The root element that encompasses the entire HTML document
  • <head>: Contains metadata about the page, such as the title
  • <body>: Contains the visible content of the page
  • <h1> to <h6>: Define headings of different levels
  • <p>: Represents a paragraph of text
  • <a>: Creates hyperlinks to other pages or resources
  • <img>: Embeds images into the page

Semantic Structure. Using the appropriate HTML elements not only structures the content but also provides semantic meaning, making it easier for search engines and assistive technologies to understand the page. This is crucial for accessibility and SEO.

3. CSS Rules Control Styling and Layout

We start this section with a chapter that explains how CSS uses rules to enable you to control the styling and layout of web pages.

Separation of Concerns. CSS allows you to separate the presentation of your web pages from their content and structure. This makes your code more organized, maintainable, and reusable.

CSS Rules:

  • Selector: Specifies the HTML element(s) to which the rule applies (e.g., p, h1, .my-class)
  • Declaration: Contains one or more properties and their values, separated by a colon (e.g., color: blue;, font-size: 16px;)
  • Properties: Control various aspects of the element's appearance, such as color, font, size, margin, and padding
  • Values: Specify the settings for the chosen properties (e.g., blue, 16px, 10px)

External Style Sheets. The best practice is to store CSS rules in external style sheets (files with a .css extension) and link them to your HTML pages using the <link> element. This allows you to apply the same styles to multiple pages, making it easy to maintain a consistent look and feel across your website.

4. Links Connect Pages and Resources

Links are the defining feature of the web because they allow you to move from one web page to another — enabling the very idea of browsing or surfing.

Enabling Navigation. Links, created using the <a> element, are the foundation of web navigation. They allow users to move seamlessly between different pages on your website and to external resources on the web.

Types of Links:

  • Internal Links: Connect different pages within the same website, using relative URLs.
  • External Links: Connect to pages on other websites, using absolute URLs.
  • Email Links: Open the user's email program and address a new message to a specified email address.
  • Anchor Links: Link to specific sections within the same page, using the id attribute and the # symbol.

Clear Link Text. Use descriptive link text that clearly indicates where the user will be taken when they click the link. Avoid generic phrases like "click here."

5. Images Enhance Web Pages

A picture can say a thousand words, and great images help make the difference between an average-looking site and a really engaging one.

Visual Communication. Images can convey information, set the tone, and create a more engaging user experience. They can be used for logos, photographs, illustrations, diagrams, and charts.

Image Formats:

  • JPEG: Best for photographs and images with many colors
  • GIF: Best for simple graphics, logos, and animations with few colors
  • PNG: Best for images with transparency or those requiring lossless compression

Optimization is Key. Optimize images for the web by saving them in the correct format, at the right size, and with the appropriate resolution (72 ppi). This will help reduce file sizes and improve page load times.

6. Tables Organize Data

When representing information in a table, you need to think in terms of a grid made up of rows and columns (a bit like a spreadsheet).

Presenting Structured Data. Tables, created using the <table> element, are ideal for presenting data in a grid format, such as financial reports, TV schedules, and sports results. They help users understand complex information by organizing it into rows and columns.

Key Table Elements:

  • <table>: The container for the entire table
  • <tr>: Defines a table row
  • <th>: Defines a table header cell
  • <td>: Defines a table data cell
  • <thead>: Groups the table header rows
  • <tbody>: Groups the table body rows
  • <tfoot>: Groups the table footer rows

Accessibility and Semantics. Use <th> elements for headings and the scope attribute to indicate whether they are headings for a column or a row. This improves accessibility for screen readers and helps search engines understand the table structure.

7. Forms Collect User Input

HTML borrows the concept of a form to refer to different elements that allow you to collect information from visitors to your site.

Enabling Interaction. Forms, created using the <form> element, allow you to collect information from visitors to your website. They are essential for tasks such as user registration, contact forms, surveys, and e-commerce checkouts.

Common Form Controls:

  • <input type="text">: Single-line text input
  • <input type="password">: Password input (masks characters)
  • <textarea>: Multi-line text input
  • <input type="radio">: Radio buttons (select one option)
  • <input type="checkbox">: Checkboxes (select multiple options)
  • <select>: Drop-down list box (select one option)
  • <input type="file">: File upload
  • <input type="submit">: Submit button

Accessibility and Usability. Use the <label> element to associate text descriptions with form controls, improving accessibility for screen readers and making the form easier to use. Group related form controls together using the <fieldset> element and provide a caption using the <legend> element.

8. Semantic Markup Adds Meaning

There are some text elements that are not intended to affect the structure of your web pages, but they do add extra information to the pages — they are known as semantic markup.

Describing Content. Semantic markup provides extra information about the content of your web pages, making them more accessible and understandable to both humans and machines. These elements don't necessarily affect the visual presentation but add meaning to the content.

Common Semantic Elements:

  • <em>: Indicates emphasis
  • <strong>: Indicates strong importance
  • <cite>: Indicates a citation
  • <abbr>: Indicates an abbreviation
  • <address>: Contains contact details for the author of the page
  • <ins>: Shows content that has been inserted into a document
  • <del>: Shows content that has been deleted from a document

Accessibility and SEO. Using semantic markup helps screen readers and search engines understand the content of your pages more accurately, improving accessibility and SEO.

9. Lists Present Content Clearly

There are lots of occasions when we need to use lists. HTML provides us with three different types.

Organizing Information. Lists are a fundamental way to present information in a clear and structured manner. HTML provides three types of lists: ordered, unordered, and definition.

Types of Lists:

  • Ordered Lists (<ol>): Numbered lists where each item has a specific order.
  • Unordered Lists (<ul>): Bulleted lists where the order of items is not important.
  • Definition Lists (<dl>): Lists of terms and their definitions.

Nesting Lists. Lists can be nested inside one another to create hierarchical structures, such as outlines or menus.

10. Optimize Images for Web Performance

You should save images at the size you will be using them on the web page and in the appropriate format.

Image Optimization. Optimizing images is crucial for improving website performance and user experience. Large image files can significantly slow down page load times, leading to frustrated visitors.

Key Optimization Techniques:

  • Choose the right format: Use JPEG for photographs, GIF for simple graphics, and PNG for images with transparency.
  • Resize images: Save images at the exact dimensions they will be displayed on the page.
  • Compress images: Use image editing tools to reduce file sizes without sacrificing too much quality.
  • Use responsive images: Serve different image sizes based on the user's device and screen size.

Faster Loading. By optimizing your images, you can ensure that your web pages load quickly and efficiently, providing a better experience for your visitors.

11. Understand Browser Compatibility

It is important, however, to remember that many computer owners will not be running the latest versions of these browsers.

Cross-Browser Compatibility. Different web browsers may interpret HTML and CSS code slightly differently. It's important to test your website in multiple browsers to ensure that it looks and functions as intended for the majority of your visitors.

Browser Testing Tools:

  • BrowserStack
  • CrossBrowserTesting
  • Browserling

Progressive Enhancement. Use progressive enhancement techniques to ensure that your website is still usable in older browsers, even if they don't support all the latest features. This involves building a basic, functional website and then adding enhancements for modern browsers.

12. SEO and Analytics Drive Success

In this chapter, we will look at some practical information that will help you launch a successful site.

Search Engine Optimization (SEO). SEO is the practice of optimizing your website to rank higher in search engine results pages (SERPs). This involves using relevant keywords, creating high-quality content, and building backlinks from other websites.

Key SEO Techniques:

  • Keyword Research: Identify the terms people are likely to search for when looking for your site.
  • On-Page Optimization: Use keywords in your page titles, headings, text, and image alt text.
  • Off-Page Optimization: Build backlinks from other websites, especially those with relevant content.

Web Analytics. Web analytics tools, such as Google Analytics, allow you to track how visitors are using your website. This data can help you understand what content is most popular, where visitors are coming from, and where they are leaving your site.

Data-Driven Decisions. By analyzing your website data, you can make informed decisions about how to improve your content, design, and marketing efforts.

Last updated:

Review Summary

4.30 out of 5
Average of 4k+ ratings from Goodreads and Amazon.

HTML and CSS: Design and Build Websites receives high praise for its visual appeal and beginner-friendly approach. Readers appreciate the clear explanations, practical examples, and beautiful design. Many find it helpful for learning web development basics, though some note it's becoming outdated. The book is praised for its logical organization and ability to make coding seem accessible. Critics mention its age as a drawback, lacking coverage of newer technologies like flexbox and responsive design. Overall, it's widely recommended for beginners but may need supplementation with more current resources.

Your rating:

About the Author

Jon Duckett is an experienced web designer and developer with over a decade of experience working with global brands. He has authored or co-authored more than a dozen books on web design, programming, usability, and accessibility. Duckett has also curated conferences on web programming and worked as a web strategy consultant. His expertise spans both front-end and back-end development, often coding front-ends and designing architectures for projects. He is best known for his bestselling books on HTML, CSS, JavaScript, and jQuery, which are praised for their accessible approach to teaching web development concepts.

0:00
-0:00
1x
Dan
Andrew
Michelle
Lauren
Select Speed
1.0×
+
200 words per minute
Home
Library
Get App
Create a free account to unlock:
Requests: Request new book summaries
Bookmarks: Save your favorite books
History: Revisit books later
Recommendations: Get personalized suggestions
Ratings: Rate books & see your ratings
Try Full Access for 7 Days
Listen, bookmark, and more
Compare Features Free Pro
📖 Read Summaries
All summaries are free to read in 40 languages
🎧 Listen to Summaries
Listen to unlimited summaries in 40 languages
❤️ Unlimited Bookmarks
Free users are limited to 10
📜 Unlimited History
Free users are limited to 10
Risk-Free Timeline
Today: Get Instant Access
Listen to full summaries of 73,530 books. That's 12,000+ hours of audio!
Day 4: Trial Reminder
We'll send you a notification that your trial is ending soon.
Day 7: Your subscription begins
You'll be charged on Apr 4,
cancel anytime before.
Consume 2.8x More Books
2.8x more books Listening Reading
Our users love us
100,000+ readers
"...I can 10x the number of books I can read..."
"...exceptionally accurate, engaging, and beautifully presented..."
"...better than any amazon review when I'm making a book-buying decision..."
Save 62%
Yearly
$119.88 $44.99/year
$3.75/mo
Monthly
$9.99/mo
Try Free & Unlock
7 days free, then $44.99/year. Cancel anytime.
Scanner

Point camera at a book's barcode to scan

Scanning...

Settings
General
Widget
Appearance
Loading...
Black Friday Sale 🎉
$20 off Lifetime Access
$79.99 $59.99
Upgrade Now →