Decorating html tags with the style attribute (inline CSS styles). Adding styles to a web page How to describe the style of an html page
CSS (Cascading Style Sheets), or Cascading Style Sheets, are used to describe the appearance of a web document written in a markup language. CSS establishes style rules that change appearance elements placed on web pages perform fine tuning their details such as color, font, size, borders, background, and location in the document.
You can embed CSS code directly into a markup element as an attribute value style. This attribute is available on all HTML elements. With CSS, you can specify a number of style properties for a given HTML element. Each property has a name and value separated by a colon (:). Each declared property is separated by a semicolon (;).
Here's what it looks like for an element
:Ways to add CSS styles
The CSS standard offers three options for applying a style sheet to a web page:
- External Style Sheet - Define style sheet rules in separate file.css, and then including this file in an HTML document using the tag
- Internal style sheet - defining style sheet rules using a tag
Example: Internal style sheet
- Try it yourself "
header
Text one
Text two
Text three
Internal style sheet header
Text one
Text two
Text three
AT this example we set the background color of the element using css
: background-color:palegreen, color and font type for headings: color: blue; font-family:verdana, and font size, color, and text alignment for paragraphs
: font-size:20px; color:red; text-align:center.
Inline style
When it is necessary to format a single element of an HTML page, the style declaration can be placed directly inside the opening tag using the already specialized style attribute. For example:
Paragraph
Such styles are called built-in (inline), or embedded. Rules defined directly inside an element's opening tag override rules defined in an external CSS file, as well as rules defined on an element
header
Text one
Text two
Text three