Appendix A. Cascading Style Sheets

Cascading Style Sheets (CSS) define how HTML elements are displayed. Styling can happen in a few different places. The most common place for CSS is an external style sheet (which is a file with a .css extension). You place a <link> between your HTML <head> tags like Listing A-1.

Example A-1. HTML header - External Stylesheet

<head>
   <link href="stylesheet.css" rel="stylesheet" type="text/css">
</head>

Note

You can use relative or absolute paths to your style sheets for the href attribute of <link>.

You can also place a <style> tag in the <head> portion of your HTML document and define your CSS there (Listing A-2); this is called an internal style sheet.

Example A-2. HTML Header - Internal Stylesheet

<head> <style type="text/css"> ...

Get Pro Smartphone Cross-Platform Development: iPhone, BlackBerry, Windows Mobile, and Android Development and Distribution now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.