Wednesday, June 3, 2015

HTML pages and the related CSS

Create your basic html page with html, head, body tags.

Now you could create another main.css page with the styling rules in it.

The structure of a CSS file will consists of multiple selector sections. Example, from the below screenshot of css file,
  • body{ .. } is the selector,
  • while the "background" within the braces is the property holding the rule and
  • the "#999" is the value of the property.

An example main.css with related html would look like below:

  • The < link > tag in the html file related the css file to it.
  • The .secondary section in the css file relates to the tag with class="secondary" in the html file.
  • The .#special section in the css file relates to the tag with id="special" in the html file.
Important note on the css file:
The selector if repeated twice, the last selector rule gets applied overriding the earlier ones.

 

No comments:

Post a Comment