Do I have to use a ID tag or a CLASS tag when I am stating the styles inside of a tag. Here's an example.

<div style="position: relative; left: auto; right: auto; top: 0px; height: 225px; width: 869px">

Since is says styles in there, do I have to put a ID or Class tag? Like this.

<div id="EXAMPLE" style="position: relative; left: auto; right: auto; top: 0px; height: 225px; width: 869px">

4 answers

3
points
This was chosen as the best answer

You only need an id or class attribute when you want to talk about a tag later... I.e. if you need to reference that element in Javascript, or if you want to style it via a CSS stylesheet, you should add a class or id.

So, to answer your question: no, you don't need it for this example.

That said, there are a number of reasons why you should move your style="foo" attributes into an external stylesheet. You should consider doing this, which would then require adding a class.

Answered over 6 years ago by Justin Hileman
2
points

Nope.

Answered over 6 years ago by Nathan Duran
2
points

inline styles are a maintenance nightmare.

use a class on the element for repeating elements on the page, or an ID where there's only one per page and move your inline styles to an external stylesheet where you can alter all the styling on every page in a single file.

Inline styles should be rarely, if ever used.

Answered over 6 years ago by Tony Crockford
  • Problem is is that I am using Microsoft Expression's, and I am not sure how to make it produce external stylesheets canyonchase1 over 6 years ago
0
points

To use external stylesheets with MS Expression, follow this tutorial: http://www.digitalfamily.com/expression/10-tips/Expression-Web-Tip-3.html

Answered over 6 years ago by Tony Crockford