34,333
edits
Changes
→Setting Styles using the ''id'' Attribute of an HTML Element
<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 the tag that has the matching id will inherit the style for that id.
== Using Classes with CSS ==
<h1 id="mainHeading">This is the main heading</h1>
</pre>