Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mislz28/public_html/wp-content/themes/css-faq-v2/timeweather/timeweather.php on line 19
  • CSS Faqs
16 May 2008

CSS Styles Eliminate Repetitions

Web designers and developers alike come across the perennial predicament of using bulky HTML tags on one page for the style properties. As a result, it consumes a lot of space and your precious times. But the rigorousness of this difficulty alleviates to a large extent while designing through Cascading Style Sheets. CSS has a perfect answer to this problem. In this article, we are now going to look at a method of applying style sheets that will make your life a little easier for you. You do not need to write the same thing again and again on a single page to have your desired effect. Read out the following in order to save your valuable time.

To begin with, we are going to declare a style within the head section of the page. A style in the head section must commence with the <STYLE> tag and finish with the </STYLE> tag. Underneath is an example that declares the style for the <SPAN> tag in the head of the document. The SPAN tag is a division in a page. It will not go to the next line after you close the tag, like the one you come across with DIV tag.

<HEAD>
<STYLE>
<!–
SPAN { color:red; font-style:italic }
–>
</STYLE>
</HEAD>

The entire thing starts with the <STYLE> tag. Right after the STYLE tag, you will observe that we start on an HTML comment. This covers up the contents of the STYLE tag from browsers that do not identify it. So it won’t be printed on your page. Now you see this line:
SPAN { color:red; font-style:italic }

This line declares that every time you use the <SPAN></SPAN> tags in your page, the text between the tags will be red and italic. One thing you will detect here that, you do not use the less-than “<" or greater-than ">” signs around the SPAN declaration. Also, as a substitute of using equal signs or quote marks, we lay the style properties inside two curly brackets { } to declare the style properties. The properties are each separated with a semicolon.

Now, as you have that in your head section, you can just use the <SPAN></SPAN> tags to make your text red and italic, rather than writing out two tags for it each time you need the effect.
<SPAN>You are red and italic,</SPAN> but he is not. <BR>
<SPAN>He is red and italic too!</SPAN>

Now if you were using Netscape, you in all probability did not see the red and italic text above. Netscape doesn’t seem to support this attribute yet. So here is what it will look like when Netscape puts out a new browser supporting this feature.

You can declare a style this way for almost any tag, but ultimately you will run out of tags or you will not want every instance of a certain tag to do the same thing. To beat this problem, we will have to use classes and IDs rather than declaring a style for the tag itself.

Tags:

Эта статья была опубликована на16 May 2008на10:33 PM в категории CSS Faqs. Вы можете следить за обновлениями в этой статье с помощьюRSS 2.0фидов. Вы можете оставить ответ, или обратную ссылку из ваше сайте.

Оставить отзыв

Name (*)
Mail (will not be published) (*)
URI
Комментарий