SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Adding a div to the right that makes the page scroll

    Morning all,

    I'm developing a site that detects the window size and calls the css accordingly.

    The problem I have is that I've just been told (been working on the site for 4 months and it goes live today) that they want a banner to appear on the far right even if the screen isn't big enoguh to accomodate it (left/right scrolling). Despite my protests they want this done.

    How can I set a div to be seperate from the main site and sit on the far right forcing the scrolling?

    Thanks in advance.

  2. #2
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can't you just use absolute position for the div and just put it to the right where you want it. That should force the window to scroll. Obviously I don't know what script you are using, but I would imagine if it changes the layout for different window sizes that it would also need to change the left position for the div you are wanting to set to the right.

    Or you might be able to use float:right to put the div to the right of what you have already designed. I guess you would have to increase the size of your page container to accommodate for the width of the div though.

    Just a few thoughts.

  3. #3
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,495
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First off (this goes for both of you), welcome to SitePoint!

    Second, using width detection to serve stylesheets is a bad idea because the user will get fed a raw HTML file if scripting isn't supported. You're better off using a constrained-min/max width elastic layout instead.

    Third, you cannot just use absolute positioning for this kind of job and expect it to work as a magic silver bullet to all of life's problems.

    What does the page look like (more specifically, what is it supposed to look like)?

  4. #4
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If he "absolutely wanted to set the div off the right side of the page couldn't he just do something like this?

    #divname {
    positon: absolute;
    right: -200px;
    height: ?;
    width: 200px;
    }

  5. #5
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,495
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nope, because absolute positioning is not supposed to be used for layout


Bookmarks

Posting Permissions

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