1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Making div float to right

Discussion in 'CSS' started by mark_s, Jul 2, 2007.

  1. #1
    I have three columns on my site with the middle column being the news. The problem is I need the news to appear first in the source code for SEO reasons.

    At the moment I have the rightbar absolutely positioned to allow for this but ideally I really need it to float on the right.

    I've made a test version of my site so I can mess with the CSS so can someone take a look and tell me how to make the right navigation (#rightbar_wrapper) float to the right yet keeping the news content at the top of the source code?

    Thanks in advance :)
     
    mark_s, Jul 2, 2007 IP
  2. mark_s

    mark_s Peon

    Messages:
    497
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Is it possible? Or must I use absolute positioning?
     
    mark_s, Jul 3, 2007 IP
  3. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #3
    deathshadow, Jul 3, 2007 IP
  4. soulscratch

    soulscratch Well-Known Member

    Messages:
    964
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    155
    #4
    soulscratch, Jul 3, 2007 IP
  5. kh7

    kh7 Peon

    Messages:
    2,715
    Likes Received:
    109
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I would go with absolute positioning and then floating the left content left and the right content right. That margin stuff never made sense to me, maybe it is just me...
     
    kh7, Jul 3, 2007 IP
  6. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #6
    It's just you ;)

    Actually, absolute positioning of COLUMNS is usually a /fail/ if you cannot guarantee the height of any of the columns will not change AND your page will have a footer... since absolutes can NEVER push the footer down. It's the whole point of float layouts is to dynamically adjust regardless of the heights of the columns.

    Absolute positioning major layout elements is almost always a /fail/... you can get away on it inside fixed-height elements with fixed-height elements - apart from that, you risk layout breakage.
     
    deathshadow, Jul 3, 2007 IP
  7. mark_s

    mark_s Peon

    Messages:
    497
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #7
    So can anyone tell me the values I should put for my css?
     
    mark_s, Jul 3, 2007 IP
  8. soulscratch

    soulscratch Well-Known Member

    Messages:
    964
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    155
    #8
    Copy one of the layouts from Layout Gala, the one that best matches your site (as there are 40 of them) and just modify them.
     
    soulscratch, Jul 3, 2007 IP
  9. mark_s

    mark_s Peon

    Messages:
    497
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #9
    I'm struggling to make this work even when looking at the examples... would someone be able to look at my CSS and give my the values?
     
    mark_s, Jul 4, 2007 IP
  10. ektz

    ektz Active Member

    Messages:
    599
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    80
    #10
    your css in the source is pretty messed. you're going for a fixed layout, right?
    so it would be easy to do. I will help you out, if u can send me only part of css u used for news and sidebars. mail me that at ekta.paneri[removethis]@gmail.com.
    will fix it in few hours.
     
    ektz, Jul 4, 2007 IP
  11. VimF

    VimF Well-Known Member

    Messages:
    307
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    118
    #11
    Add to the #newswrapper in the mw.css (line 17)

    float:left;
    margin:0px -800px 0px 129px;


    To the #navbar_wrapper (line 56)

    float:left;
    margin:0pt -200px 0pt 0pt;


    To the #rightbar_wrapper (line 66)

    float:left;
    margin:0pt 0pt 0pt 610px;
     
    VimF, Jul 4, 2007 IP
  12. mark_s

    mark_s Peon

    Messages:
    497
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Thank you very much VimF but your code works for FF but not for IE 6 and below.

    I have a IE only CSS, would you know different values needed for that?

    I've made the changes you gave.
     
    mark_s, Jul 4, 2007 IP
  13. VimF

    VimF Well-Known Member

    Messages:
    307
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    118
    #13
    Okay then add these to your IE only css:

    #newswrapper { float:left; margin:0 0 0 64px; width:468px; height:100%; }
    #navbar_wrapper { position:absolute; left:10px; top:10px; width:116px; overflow:hidden; margin:0; }
    #rightbar_wrapper { float:right; width:171px; margin:0; }
     
    VimF, Jul 4, 2007 IP
  14. mark_s

    mark_s Peon

    Messages:
    497
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Thank you so much, all working :D
     
    mark_s, Jul 4, 2007 IP