Choose a link to get started:ALL NEW!!!Scrolling MarqueesThe BasicsThe BasicsManipulating Text Images Backgrounds Links More Advanced TopicsThe <HEAD> TagTables Forms Frames Lists Advanced TopicsImage MapsCSS - Part 1 CSS - Part 2 CSS - Part 3 CSS - Part 4 Additional TopicsXML Tag FormattingXHTML - Part 1 XHTML - Part 2 |
CSS - Part 1Have you ever noticed that when you want something different to appear twice on a page, you have to type in the script twice, or as many times as you want it to appear on the page? This can become quite time consuming and quite annoying if your script is large or complex. Have you ever wanted some way to make it easier? Well my friend, you have found the place. Using CSS, or a Cascading Style Sheet, makes that all a thing of the past. Look at the CSS skeleton.
The stylesheet, above, goes inside of the <HEAD> section of the script. I did not included this is the <HEAD> tutorial because of its tutorials here. Let's look at the script one more time. This time, however, we will break it down.
CSS with individual tags Before we get to the stylesheets, we will learn to use the STYLE attribute of different tags. Any tag can have STYLE attached to it. For example, say you wanted to make the page title, CSS Basics, the color blue. First, you must write the regular script. That is shown below. <H1>CSS Basics</H1> Then add the STYLE attribute to the tag. We get more difficult now. The script for color in stylesheets in individual tag is color: colorname So, we use this <H1 STYLE="color: blue">CSS Basics</H1> Using that yields : CSS BasicsAll values of the STYLE attribute will have a : in it. Now let's say we wanted the text to be underlined. Well, the script is shown below.
text-decoration: decorationtype For underline, use underline as value : <H1 STYLE="text-decoration: underline">CSS Basics</H1> This yields : CSS BasicsNow let's say that you want to use both. You want the heading both blue and underlined. The code is shown below. Place the color script as the value of STYLE <H1 STYLE="color: blue"> Place a semicolon, ;, after it <H1 STYLE="color: blue;"> Add the underline script <H1 STYLE="color: blue; text-decoration: underline">CSS Basics</H1> Use the script to yield : CSS BasicsYou have just learned an important concept. To separate the modifiers from each other, use the semicolon, ;. This is used in the <STYLE> section too. We will stop here for the moment. As you progress in CSS, you will learn more about how to modify the selector, or the tag, class, or id it defines. Here is a list of what modifications we have learned.
The next CSS tutorial will discuss modifying individual tags in the <STYLE> section. Good Luck!!! |