CSS or Tables?
The 30 minute CSS tutorial. What is CSS? CSS is the technology used to make the layout for webpages. They are Cascading Style Sheets, used to style your HTML documents. They are slowly replacing tables as the preferred medium to layout your pages. They free your content (the HTML document) from the layout (the CSS file), so you may change your website look and feel easily. CSS basics. With HTML, you would define the attributes as you write the HTML. With CSS, you first define the style. Then as you are writing the HTML, you apply the required style. So the first step to write CSS document is defining your styles. There are two ways to apply your CSS to your file. You may either include it in your HTML file by placing your stylesheet in head of your HTML as, ...
, The Selectors. After you write your style, the computer needs to know where to apply that style. This can be done using the selectors. The selectors are of three types. 1. HTML tag selector: If you want to change the look of any of your html tags, you will use this type of selector. You may decide that all of your h2 elements must have red text. It is trivially easy with CSS. 2. Class selector: you would like particular parts of your webpage to have a style, but that part is not always in same html tag. Not to worry, you can enclose that part with a div tag and apply your style. 3. ID selectors: If some element occurs only once it is styled using id selectors. Your First Stylesheet. With your first stylesheet, you will modify the page to look yellow with a blue foreground.
Comments on this article