learning-journal

A place where I can learn or take notes

View on GitHub

Design Webpages With CSS

Introducing CSS

Understanding CSS

The key to understanding CSS is to imagine there is an box around every HTML element. CSS allows you to create rules that control the way each box is presented.

CSS Associates Style Rules with HTML elements

CSS assigns rules to HTML elements, which governs how the content should be displayed using a selector -indicating which element it applies to- and a declaration -indicating how the element should be styled.

CSS Properties Affect How Elements Are Displayed

CSS declarations are made up of a proerty -indicating the aspects you want to change- and a value -specifying the settings you want to use- seperated by a colon between them and a semicolon between others within curly bracers.

Using External CSS

<link> is used in HTML to tell the browser where to find the CSS file.
href specifies the path to the CSS file.
type specifies the type of document being linked to. rel specifies the relationship between the HTML and the linked file.

Using Internal CSS

<style> can be placed within the <head> to include CSS in an HTML file.

How CSS Rules Cascade

If there are two or more rules relating to the same thing, one will take precedence.

back