Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Mar 2003
    Location
    San Francisco
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts

    div & span: theoretical question

    Here's an HTML/CSS issue I'm struggling with: I pretty much use <div> and <span> solely for style purposes. I may have some DIVs and SPANs in my markup, prior to worrying about style. By the time I've implemented my style, though, I have added many additional DIV and SPAN elements. They're there solely for the design.

    For example, this design has five nested DIVs:http://muledesign.hoologic.com/hmm.html

    Or, let's say you want to display a word, and have the font size of each successive letter to increase by one. You'd have a ton of nested SPANs that have nothing to do with the content.

    Is this just the way things work? Do purists never add additional DIV or SPAN tags beyond what is needed to properly define the document's content?

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Sadly, there is no other alternative currently. You have to introduce an element for each thing you want to style. Even worse, because iew doesn't support CSS2, CSS3 even less, we have to give each element it's own id or class. A real purist would probably still introduce an element each, but not give them any class or id, unless he intended to use the styles for each letter multipler times in the document, and maybe not even then, if the situations were similar enough.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #3
    New Coder
    Join Date
    Mar 2003
    Location
    San Francisco
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Maybe it makes sense to use <DIV> and <SPAN> (uppercase) for elements that are being added strictly for stylistic purposes, and use <div> and <span> (lowercase) for those that are being used for actual content markup? Or vice-versa, of course.

  • #4
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Purists use lowercase - since XML is case sensitive and purists use XML.

    OH, and remember that the structure must be there for the style to be able to add presentation to it. There's no real reason why you SHOULDN'T add structure it it's going to be used for something. It's just that we think that the structure should be be describing the document or preferably the content, instead of being there for presentational reasons only.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •