one is a class selector the other is an id selector
put simply you can only use # once in your html but you can use . several times. So if you've got a style you want to apply to more than 1 tag use .maintext
Conversely, you can only refer to a named element once per page. A named element can also be referred to and modified with JavaScript.
Named elements are useful for defining blocks of content.
You can then define rules for standard HTML tags based on where they appear in your document.
i.e. <li>tags in your main content display differently to <li> in your left column.
The benefit of this approach is that your code is much tidier as you do not have classes declared all over the place.
Personally I favour defining CSS ruled for standard HTML elements, and rules for named elements as per my page structure. Such as #content or #navigation.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.