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 8 of 8

Thread: I Need Help!

  1. #1
    New Coder
    Join Date
    Jul 2008
    Posts
    50
    Thanks
    8
    Thanked 0 Times in 0 Posts

    I Need Help!

    This may be a dumb question, but I'm kind of new to this whole thing. I'm coding a site with CSS and am running into a few issues with floating objects.
    For instance, when I float an object right, and then I float another one, it aligns the second object on the left side of the first, rather than under it. I hope someone can understand that. I want to float things to the right, stacked on top of each other, not next to each other. What do I do?

  • #2
    Senior Coder jcdevelopment's Avatar
    Join Date
    Oct 2007
    Location
    Cowboy Nation
    Posts
    2,179
    Thanks
    174
    Thanked 257 Times in 257 Posts
    Code:
    .boxItem {
    float:right;
    clear:right;
    }
    .boxItem {
    float:right;
    clear:right;
    }
    Thats an example of clearing floats, or just creat a class to do it.

    Code:
    .clear {
    clear:both;
    }

  • Users who have thanked jcdevelopment for this post:

    taylortsantles (07-18-2008)

  • #3
    New Coder
    Join Date
    Jul 2008
    Posts
    50
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Thank you so much, I'll give it a try.

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Create a div that surrounds the floats that is just wide enough for the floats. Now float the div rather than the floats. If you kept floating things to the right you could use clear:right; on the floats so they stack below each other but its going to be harder to work with those floats.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • Users who have thanked _Aerospace_Eng_ for this post:

    taylortsantles (07-18-2008)

  • #5
    New Coder
    Join Date
    Jul 2008
    Posts
    50
    Thanks
    8
    Thanked 0 Times in 0 Posts
    That's a great idea. I think that will work the best. I appreciate it.

  • #6
    New Coder
    Join Date
    Jul 2008
    Posts
    50
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Margin

    Is using margin the best way to position things within divs?

  • #7
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Depends on what type of layout you are going for but yes its better to avoid absolute positioning.

    Check out the CSS Layouts here: http://bonrouge.com
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • Users who have thanked _Aerospace_Eng_ for this post:

    taylortsantles (07-18-2008)

  • #8
    New Coder
    Join Date
    Jul 2008
    Posts
    50
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Making a separate div for it worked great. I really appreciate the advice.

    Thanks,
    Taylor


  •  

    Posting Permissions

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