Simple CSS Question

Okay I have some simple CSS questions I hope someone doesn’t mind answering.

When I am in HTML and I want to put a Class to a section I obviously put the name of the CSS class in the tag. But from the CSS page shouldn’t I be putting a dot in front of the style for the CSS to find it? Or don’t I have to do that.

I found this CSS in a tutorial and am a little confused. Since I put the dot before.body the class finds this style. But what are the other characters for?

html {
	margin: 0;
	padding: 0;
	}
.body { 
	font: 75% georgia, sans-serif;
	line-height: 1.88889;
	color: #555753; 
	background: #fff url(blossoms.jpg) no-repeat bottom right; 
	margin: 0; 
	padding: 0;
	}
p { 
	margin-top: 0; 
	text-align: justify;
	}
h3 { 
	font: italic normal 1.4em georgia, sans-serif;
	letter-spacing: 1px; 
	margin-bottom: 0; 
	color: #7D775C;
	}
a:link { 
	font-weight: bold; 
	text-decoration: none; 
	color: #B7A5DF;
	}
a:visited { 
	font-weight: bold; 
	text-decoration: none; 
	color: #D4CDDC;
	}
a:hover, a:active { 
	text-decoration: underline; 
	color: #9685BA;
	}
acronym {
	border-bottom: none;
	}


/* specific divs */
#container { 
	background: url(zen-bg.jpg) no-repeat top left; 
	padding: 0 175px 0 110px;  
	margin: 0; 
	position: relative;
	}

#intro { 
	min-width: 470px;
	}

Some tags body, P, H1, H2 are inbuilt recognised tags of the html itself so you dont have to add a dot in front of them.

if you have


p{
font-size:16px;
}

then this style is applied to complete document where <p> tag is.

if you want to style particular <p> tag in the document somewhere then you can create a separate class for it.


.font14{
font-size:14px;
}

and apply it to particular <p> tag in document.


<p class="font14">hello </p>

vineet

The period (.) preceding a name matches the class and is a ‘class selector’ as was mentioned above. For the ‘ID selectors’ you use a preceding hash (#) immediately followed an ID value, which is within [your] HTML document (and the ID name has to be unique occurrence within the markup).

The plain (x)html element, will match any tag, i.e. (h3) that occurs in the markup and has the same name; it doesn’t necessarily have to be a pre-recognised Element. As long as the ID value matches the document it is linked to - though for HTML 4.01 it will be one or more of the tags in HTML language grammar.

The :link ‘pseudo-class’ applies for links that have not yet been visited, and so forth.

Thanks for the feedback.
I’m learning CSS as you know. Can you tell me if the CSS for the text on this page is a disaster or okay?

CSS for Text

I’m not sure if I understand you completely, hte text on that page is completley fine :). Normally, styled text makes it harder for the user to read. Black text o nwhite background is usually fine.

You might want to check out a different font though. It looks bland :slight_smile: