These articles cover the basics as well as cutting edge developments in HTML.  Home HTML and CSS Articles How to create a structured and easy to modify website using CSS
Your Ad Here

How to create a structured and easy to modify website using CSS


How to create a structured and easy to modify website using CSSLet us suppose a scenario where your website, having 10 html pages, requires the modification in the way the text looks...color, font or size. If you are using the simple html coding then you are required to open all the pages individually and modify the text on each page. While you are doing this you might be thinking that instead of editing each page individually...if you were able to modify the font at one place to reflect the changes in all the 10 pages. That's where CSS comes into picture.

What is this CSS...it stands for Cascading Style Sheet.

How does it help to resolve the above mentioned problem...CSS is a style language or tool which is used to add the layout to the website. Now I'll explain step by step how we can save the time if we have to edit the look of the text on all the pages. There are basically three methods to do the same.

Method 1 : In-line (the attribute style)

This method uses the HTML attribute STYLE and requires you to make the changes in every text you want to modify. Hence this doesn't resolve the purpose of time saving.

<DIV style="font-family: arial, verdana, sans-serif; font-weight: bold;"> This text has been modified using the style attribute of the div tag </DIV>

Method 2 : Using the style tag in the HEAD section.

This method is better but not the best as each page would required to be opened and changed for the modifications.

Put the code written below under the HEAD section

<STYLE type="text/css"> div { font-style: italic; font-weight: bold; font-size: 30px; font-family: arial, sans-serif; } </STYLE>

Put the code written below under the BODY section

<DIV>This text will show the text style defined in the STYLE tag</DIV>

Method 3 : External (link to a style sheet)

An external style sheet is simply a text file with the extension .css. Like any other file, you can place the style sheet on your web server or hard disk. This is the recommended method as change in one .css file will reflect the change in all the html files which will include the style defined in css file

Let's assume all the html files are in html folder and css files are in style folder

Following is the code for stylefont.css

div { font-style: italic; font-weight: bold; font-size: 30px; font-family: arial, sans-serif; }

Following is the code to include the css file, this will be placed under the HEAD section

<link rel="stylesheet" type="text/css" href="/img_articles/16998/style/stylefont.css" />

Put the code written below under the BODY section

<DIV>This text will show the text style defined in the DIV tag defined in the css file</DIV>


Author's URL: Satwinder Kaur
Thank you for voting.
Rate this Materials:
Bad 
1 2 3 4 5 Excellent
print this page subscribe to newsletter subscribe to rss

HTML is Hyper Text Markup Language that is used to make hypermedia and hypertext documents for the Web. More HTML and CSS: Most Popular Materials | Fresh Materials | More HTML Tutorials at Markuptutorials.com

Add comments to "How to create a structured and easy to modify website using CSS"

Only registered users can write comment

No comments yet...