1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

bit of a weird one...

Discussion in 'Web Development & Web Hosting' started by IThurts, Apr 1, 2008.

  1. IThurts

    IThurts Kilobyte Poster

    284
    2
    32
    Hi chaps and chappettes,

    Ok please help...Scenario::

    i use a div id called #topic-links WITHIN my main-text area..
    i want to be able to resize the margins of my main-text area and allow the links within #topic-links to move along with it, ie; resize relative to the main-text area. If i move the main-text area's right margin to the left, should the links move in unison/relative to the page??

    Should i even be using div id's for styling links and such WITHIN the main-text area? Should i use div classes? I used a div id for the topic-links because a)i didnt know what else to use.. b)its the only way i could think to style the links how i wanted them styled without styling ALL of the links within main-text the same way.
    So i guess i could have used a class selector like ".topic-links", then ".topic-links ul li" for the padding etc for the css, but if i did it that way, would i then have to use <span class="topic-links"> for the html?

    I read something on the net the other day that said you should refrain from using div id's for everything....now that's haunting me as u can see from my rant above...what should i use next time & when and where should u use div ids?

    Sorry if this sounds a bit like....:eek:.....:blink......"whats he on about", type thing, my mind goes a bit cloudy someti......well most of the time.:) I have bolded the real questions inside of my babble for your eye-ing pleasure.
     
    Certifications: BTEC national Diploma Computer Studies
    WIP: See Sig
  2. Mitzs
    Honorary Member

    Mitzs Ducktape Goddess

    3,282
    73
    152
    ok, if I have this wrong someone will jump in and save us both. :biggrin I am only in chapter 7, so you are a little ahead of me but if I understand it right....

    If you have a page layout element that is set for a certain width your nav bar should move with it if you have it within that page layout.
     
    Certifications: Microcomputers and network specialist.
    WIP: Adobe DW, PS
  3. IThurts

    IThurts Kilobyte Poster

    284
    2
    32
    Just as a side note, if it matters...my #topic-links is not my navbar, they are links at the top of my main-text to take folk to different topics within my main-text page...just an easy way around my page really.

    Hence why i was asking should i be using a div id for these?
     
    Certifications: BTEC national Diploma Computer Studies
    WIP: See Sig
  4. thecatsmother

    thecatsmother Byte Poster

    100
    4
    20
    So, this is not a separate area for links situated in the main text div? You just want to style the topic links within the flow of the main body of text? If so, they don't need to be a div, just define a style for them and use span to apply it each time. If you're talking about something else, I have no clue what it is :)

    Oh wait, I've got you. These are links to anchor points within the same page, yeah? While you're grouping them together at the top, I imagine you will also want to put a "Back to top" type link after each section too, so it makes more sense to me to do it the way I said in my first para rather than a div.
     
    WIP: CIW Website Design Manager
  5. IThurts

    IThurts Kilobyte Poster

    284
    2
    32
    Yes i thought as much...
    When u say define a stlye, are u meaning to use a class? ie: .topic-links{} for the css and then the HTML would be
    <span class="topic-links"> LINKS HERE </span>

    So whats the "danger" of using a div id instead of a class in relation to what you have correctly mentioned for my situation, or any situation at that.
     
    Certifications: BTEC national Diploma Computer Studies
    WIP: See Sig
  6. thecatsmother

    thecatsmother Byte Poster

    100
    4
    20
    Yes, that's what I meant by defining a style.

    The "danger" of using a div in this situation? Well, as I see it, the more divs you have the more complicated the layout becomes, the more difficult it becomes to control things like floats, padding and margins, especially to get them to display as intended across different browsers. The simplest solution which does the job is often the best solution. I'd be tempted to use a div if this were going to be a consistent feature across multiple pages (like a navbar), but from what you're saying it only refers to this one page. A div is overkill there. Also, if you wanted "back to the top" links after each section of the page to have the same style, you'd have to stick each of these in a div too.... messy!
     
    WIP: CIW Website Design Manager

Share This Page

Loading...