Beginning HTML5 and CSS3 For Dummies
Book image
Explore Book Buy On Amazon

CSS is a style sheet language used to define the appearance and formatting of a document written in a markup language — often HTML. A style in this sense is a set of text-formatting instructions, such as font, color, size, and so on. Because CSS instructions exist separately from HTML code, you can apply the same set of instructions to every page in your website, or to more than one website. Here's a list of common HTML instructions used in conjunction with CSS:

  • To link within HTML to an external style sheet, use the following structure:

    
          "stylesheet" type="text/css" href="stylesheet.css" />
    
  • To embed styles within an HTML page:

  • Using a body style to design the overall page:

    body {
          margin:0;
          padding:8px 4px 12px 4px;
          color:#ffbf11;
          background:#000000 url(images/space.gif);
    }
  • To use a class selector in HTML:

    "caption">This is a caption paragraph

  • To use an ID selector in HTML:

    "sidemenu"> ...menu links...
  • Common type selectors:

    body {...}
    p {...}
    td {...}
    ul {...}
  • Common class selectors:

    .caption {...}
    .banner {...}
    .main {...}
  • Common ID selectors:

    #mainParagraph {...}
    #sidemenu {...}
    #footer {...}

About This Article

This article is from the book:

About the book authors:

Ed Tittel is a 30-year veteran of the technology industry, with more than 140 computing books to his credit, including the bestselling HTML For Dummies. Chris Minnick is an author, trainer, and web developer who has worked on web and mobile projects for both small and major businesses. Learn more at watzthis.com.

This article can be found in the category: