Where can CSS codes be placed in a web page?
CSS codes can be placed in couple of ways:
(a).Current HTML Page
(b). External file saved with .css extension
(a).Current HTML Page
(b). External file saved with .css extension
There are three important places where CSS code can be easily placed inside current HTML page.
- It can be inserted in the HEAD section
<html><head><title>Page title goes here</title>
<style type="text/css">selector {property1:value;property2:value;}</style></head><body>... Page cotent ...</body></html>
2.In a <style> tag
<style
type="text/css">
selector
{
property1:value;
property2:value;
}
</style>
3.Inside the HTML element, with "style" attribute.
<p style="color:blue;font-weight:bold;">This paragraph has used style attribute
of tag p.</p>
When
the CSS code is written in an external file, the CSS code is written in the
same manner, but without the <style> tag.
CSS-based style sheets contain list of statements , this list of statements
is also called Rule Set.
A rule set in in fact combination of a
selector and a declaration block. This block usually has an opening and closing
braces i.e.’{‘ and ‘}’ like c language. The block can have style properties and their
values.
No comments:
Post a Comment