Css Spans
- Started
- Last post
- 9 Responses
- jaylarson
Dear NT,
Can SPANs be used more than once? I iknow that DIVs must be unique, but is it the same with SPANS?
- UndoUndo0
any tag like SPAN or DIV can be used as many times as you like, the rule you are confusing is that using an id in a tag like
[div id="myID"] can be used once
but classes can be used as manytimes as you like
[div class="myClass"]
you with me?
- jaylarson0
UndoUndo,
I understand:"[div id="myID"] can be used once "
but is the same for:
[span id="myID]?I have a page full of repeating div's, each erroneously having the same ID. If I convert these to SPANs is this just as wrong?
here is page:
http://www.laserpointer.net/gree…BTW, I dig the name 'UndoUndo' it's funny as me and several of us here can surely relate.
- jakeyj0
i typically stay away from spans and use classes instead.
- UndoUndo0
cool, you can use as many divs and spans as you like when they are defined with a class so
[div class="myClass"]
or
[span class="myClass"]but when they are defined by ids you can only use the once
[div id="myID"]
or
[span id="myID"]
- weestu0
change your ids to classes. An id can only be used once but a class can be used as many times as you want.
- UndoUndo0
a span is different from a class.
a span is a tag and a class is the definition of a tag (they way it looks and is positioned)
- jakeyj0
"The primary difference between the and tags is that doesn't do any formatting of it's own. The tag acts as a paragraph break, because it is defining a logical division in the document. The tag simply tells the browser to apply the style and align rules to whatever is within the ."
That's why I use classes (with Divs) instead of spans. Keeps everything nice a modular for me. Personal preference i guess
- jaylarson0
Thanks again everybody. Again further proof of the good that this site offeres. Thank you!