Cascading Style Sheets
Cascading Style Sheets
CSS is a stylesheet language that describes the presentation of an HTML/XML document. It stands for Cascading Style Sheets. CSS describes how HTML elements must be rendered on the screen or in other media. It describes the Look and feel and formats HTML documents written in a markup language like HTML.
Learning CSS is easy and a must for anyone working with web design. CSS web designers should have basic knowledge of HTML and JavaScript.
We can specify the CSS inline, within the HTML or refer to an external stylesheet. External stylesheets are stored in the *.css files.
The main advantage of CSS is that we can declare the presentational style attributes only once in the .css file.
CSS Syntax
CSS uses several English keywords to specify the names of various style properties. A CSS rule-set consists of a CSS selector and a CSS declaration block.
The general CSS syntax is as follows:
selector { property: value; }
The selector is the HTML element that we want to style.
The CSS declaration block contains one or more declarations separated by
semicolons. A CSS declaration always ends with a semicolon.
{ property: value; } is a declaration block that consists of a list of declarations in braces. Each declaration itself consists of a CSS property, a colon (:) and a value. Multiple declarations can be inserted in a single block.
Example
Some examples are as follows:
h1 { color: blue; }
The CSS code will make all the h1 headings in the document blue in color.
Multiple CSS declarations
h1 { color: blue; font-size:24px; }
Advantages
CSS is used to define the styles of web pages, including the design, layout, and variations in display for different devices and screen sizes. For example, CSS can control the layout of web pages on a computer screen, laptop screens, tablets, mobile device screens, etc.
Insert CSS
To insert CSS code to a web page:
https://www.testingdocs.com/insert-css-code-to-an-html-document/
—
HTML Tutorials
HTML Tutorials on this website:
https://www.testingdocs.com/html-tutorials/
https://www.w3.org/TR/html401/intro/intro.html