Changes

Jump to: navigation, search

Understanding Cascading Style Sheets (CSS)

3,251 bytes removed, 17:35, 17 May 2007
no edit summary
To set the style for an individual HTML element in a web page simply include the style rule inside the HTML tag. the following HTML tag specifies a color rule from just the current <H1> tag:
 
== Setting Styles using the ''id'' Attribute of an HTMl Element ==
 
When defining an HTML tag it is possible to asdsign that tag an id. For example we might create a heading element with the ''mainHeading'':
 
<pre>
 
 
<pre>
<h1 id="mainHeading">This is the main heading</h1>
</pre>
 
having defined the ''id'' we can now create a CSS rule specifically for this element ''id'' by prefixing the id with a ''#'' character:
 
<pre>
#mainHeading {color: blue; font-style: normal}
</pre>
 
== Setting up Styles using Classes ==
 
<pre>
<pre>
<h1 id="mainHeading">This is the main heading</h1>
</pre>
 
having defined the ''id'' we can now create a CSS rule specifically for this element ''id'' by prefixing the id with a ''#'' character:
 
<pre>
#mainHeading {color: blue; font-style: normal}
</pre>
 
== Setting up Styles using Classes ==
 
<pre>
 
 
having defined the ''id'' we can now create a CSS rule specifically for this element ''id'' by prefixing the id with a ''#'' character:
 
<pre>
#mainHeading {color: blue; font-style: normal}
</pre>
 
== Setting up Styles using Classes ==
 
<pre>
<h1 id="mainHeading">This is the main heading</h1>
</pre>
 
having defined the ''id'' we can now create a CSS rule specifically for this element ''id'' by prefixing the id with a ''#'' character:
 
<pre>
#mainHeading {color: blue; font-style: normal}
</pre>
 
Now any tag that has the matching id will inherit the style for that id.
 
== Setting Styles using the ''id'' Attribute of an HTMl Element ==
 
When defining an HTML tag it is possible to assign that tag an id. For example we might create a heading element with the ''mainHeading'':
 
<pre>
<h1 id="mainHeading">This is the main heading</h1>
</pre>
 
having defined the ''id'' we can now create a CSS rule specifically for this element ''id'' by prefixing the id with a ''#'' character:
 
<pre>
#mainHeading {color: blue; font-style: normal}
</pre>
 
Now any tag that has the matching id will inherit the style for that id.
 
<h1 id="mainHeading">This is the main heading</h1>
</pre>
 
having defined the ''id'' we can now create a CSS rule specifically for this element ''id'' by prefixing the id with a ''#'' character:
 
<pre>
#mainHeading {color: blue; font-style: normal}
</pre>
 
Now any tag that has the matching id will inherit the style for that id.
 
<h1 id="mainHeading">This is the main heading</h1>
</pre>
 
having defined the ''id'' we can now create a CSS rule specifically for this element ''id'' by prefixing the id with a ''#'' character:
 
<pre>
#mainHeading {color: blue; font-style: normal}
</pre>
 
Now any tag that has the matching id will inherit the style for that id.
 
 
 
<h1 id="mainHeading">This is the main heading</h1>
</pre>
 
having defined the ''id'' we can now create a CSS rule specifically for this element ''id'' by prefixing the id with a ''#'' character:
 
<pre>
#mainHeading {color: blue; font-style: normal}
</pre>
 
== Setting up Styles using Classes ==
 
<pre>
<h1 id="mainHeading">This is the main heading</h1>
</pre>
 
having defined the ''id'' we can now create a CSS rule specifically for this element ''id'' by prefixing the id with a ''#'' character:
 
<pre>
#mainHeading {color: blue; font-style: normal}
</pre>
 
Now any tag that has the matching id will inherit the style for that id.
== Setting Styles using the ''id'' Attribute of an HTMl Element ==

Navigation menu