By William Harrel

Part of HTML, CSS, and JavaScript Mobile Development For Dummies Cheat Sheet

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:

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

    <style type="text/css">
          styles ...
  • Using a body style to design the overall page:

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

    <p class="caption">This is a caption paragraph</p>
  • To use an ID selector in HTML:

    <div id="sidemenu"> links... </div>
  • Common type selectors:

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

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

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