|
HTML Tutorial: CSS Styles |
|
style= attribute. Assign a text string defining styles in this form:
property:value
Or assign lots of property/value pairs, separated by semicolons:
prop:val; prop:val; ...
Look at the heading for this section ("The Style Attribute"). The lowercase letters are really smaller uppercase letters. How did that happen? Here's the line of HTML:
<h3 style='font-variant:small-caps'> The Style Attribute </h3>
By the way, using multiple styles of headings will really confuse people, so don't do it. (Don't do it unless you're trying to make a point about styles in headings.)
style=) Attribute style='font-variant:small-caps' in the title in your index.html. If you like it, keep it. If you don't like it, take a look at your CSS reference for some other ideas. Styles should be fun.
<h6> headings are completely useless (too small to read), I use them for a custom heading. The heading above is an <h6> heading. It's the heading definition used in the HTML poster.
This is the addition I made to this page's head section:
<style>
h6 {
color:#300060;
font-size:20;
font-variant:small-caps;
margin-bottom:5;
text-align:center
}
</style>
</head>
tag { background-color:#ff0000; }
Why? It's to make sure that I'm really applying the style to the tag I think I'm trying to change. Once your table or heading changes to bright red, you'll know you're on the right track. Then you get to work on the styles you want.
|
Here are some comments re that stylesheet.
<em>. Here's the definition for <em> that I use in this site to surround file names.<body> tag the banner and navbar wouldn't have come out the way I wanted.) class= Attribute class= attribute is another that can be used with almost every tag. The code for the body tag used in almost every page here is:
<body class=main>
The banner and navbar pages use their respective classes, of course.
<div> ) and Span ( <span> ) Tags <div>) and end div (</div>) tags create an HTML block. You can use their style= and/or class= attributes to define the style of the block.
The span (<span>) and end span (</span>) tags define an inline portion, just as div tags define a block. You can also use style= and/or class= attributes of a span.
You can use this knowledge to create wonderful effects. Or you can do horrible, garish web pages. Its up to you.
<link
href="html-tutorial.css"
rel=stylesheet
type="text/css">
<h3> as enhanced in the site's stylesheet. The words "Your Choice" in the heading above are enclosed teletype tags (<tt>) also as defined in the stylesheet. If your site is going to grow to many pages, a stylesheet will save you tons of trouble.
On the other hand, for a simple site with just a few pages, a stylesheet may be more trouble than it's worth. You decide whether to create one for your site. If you decide to create one, that trick about starting a tags style with background-color:#ff0000 will help you get started.
bgcolor='#ddccdd' .
Finally, there's a whole language, JavaScript, to look at.
| What's JavaScript? |
¹A professional web designer would criticize my continued use of deprecated features ( <center> , for example) and use of tables as spacing elements. It's very 20th century. My reply: I'm glad we have professional web designers but I'm not one and neither is my audience. We are strictly part-timers, happy not to need to learn another big subject in addition to HTML.
²Actually, the stylesheet shown in this page was the stylesheet when I wrote this page. There will probably be some changes before you get here. Check http://www.easyHTMLtutorial.com/html-tutorial.css to view the version you're using right now.
P.S. It's Saturday morning and rain has cancelled the hike my puppy and I had planned. He's curled up in the corner. I'm playing with the <h3> tag in the stylesheet.