CSS: What is Cascading Stylesheet (CSS)?


CSS is the language for defining how the HTML Document is presented. Presenting HTML document to a user means turning it into a form that is usable for our readers. Browsers, such as Firefox, Chrome or Internet Explorer, are designed to present HTML documents visually.

CSS Visually


How to Implement CSS into HTML?
There are 3 ways to implement CSS into HTML such as External CSS, Internal CSS, and Inline CSS.

1. External CSS
CSS codes are put in other file which is separated with HTML file.

External CSS


2. Internal CSS
CSS codes are put in HTML head.

Internal CSS

3. Inline CSS
CSS codes are in the same line with contents (inside HTML body).

Inline CSS

Which way is the best CSS implementation?
It depends on the purpose of using CSS. If you want CSS to be used for various HTML files then the right way is External CSS but if CSS only wants to be used for 1 HTML file then the right way is to use Internal CSS or Inline CSS.


External and Internal CSS Selector
We will use CSS Selector when we will implement External and Internal CSS into HTML. Some selectors are defined below.

    .class
    Apply rules by class.

    #id
    Apply rules based on id.

    p
    Apply rules based on element name.

    input[type="text"]
    Apply rules based on the attributes of the selected item.


More CSS Reference can be read from:

Comments

Popular posts from this blog