In-line Styles
To use in-line styles you place the "style" attribute within the relevant HTML tag. The style attribute can contain anyCSS property.An in-line style can apply to a whole HTML element or it can apply to a selected area within that element. Forexample it can apply to a whole paragraph or it can apply to only a string of text within the paragraph.The following HTML and CSS code shows you how to apply in-line styles.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head> <title>this is the title of the web page</title> </head><body><p
style="color: red"
> the text in this paragraph is red </p><p> this is the
<span style="color: red"
>best CSS and HTML tutorial
</span>
available on the world wide web</p></body></html>The above HTML and CSS code will make a web page with the following 2 paragraphs.the text in this paragraph is redthis is thebest CSS and HTML tutorialavailable on the world wide web
CSS Background Code Tutorial
You can define the background effects of an HTML element with the use of CSS background properties.
How to set the background color with CSS
The following HTML and CSS code example shows you how to set the background color of an element.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><title>this is the title of the web page</title><style type="text/css">body {background-color: yellow;}h1 {background-color: #00ff00;}h2 {background-color: red;}p {background-color: rgb(250,0,255);}</style></head><body><h1> This is a level 1 header </h1><h2> This is a level 2 header </h2><p> This is a paragraph </p></body></html>
Leave a Comment