Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Aligning issue with floating divs

  • This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #36154
    joepk
    Participant

    I have a question about aligning divs that float left.

    In the image you see the issue that I have.

    The divs have margins right and left 20 px

    But I only want this to have influence on the content that is in it.

    Is there a way to get this done? I really need this because my website is all about strict alignments.

    http://img15.imageshack.us/img15/7108/probkj.jpg

    #94802
    jamygolden
    Member

    I can’t access the image.

    But how about changing the margin property to “padding”?

    #94804

    Does the container have a background image? There is an easy way around it if it doesn’t.

    #94825
    joepk
    Participant

    Here I have the issue in html/css : LINK I know there ways arround but they cost more energy to apply. My solutions is a smarter one, just make the parent ignore the margin of the childs! So no individual classes per block is needed.

    Hope this makes it a bit clearer ;)

    #95052
    joepk
    Participant

    Anyone?

    #95059
    matthewb
    Member

    @joepk

    Hope this works for you

    .block {
    background-color: #CCCCCC;
    float: left;
    height: 170px;
    margin-left: 20px;
    margin-top: 20px;
    width: 170px;
    }

    #95065

    I would highly recommend using the solution I have taken the time to outline for you here: http://jsfiddle.net/sl1dr/pjBAd/

    #95071

    @andy_unleash Put simply: it’s not what they were meant to be used for. We have used them as CSS offers nothing better, although that looks set to change. Evidence to my opinion is the number of issues with float based layouts. The biggest culprit being the need to use a clearfix hack. Most of the time, inline-block will suffice.

    #100352
    joepk
    Participant

    It has been a while I looked over here! Thanks for the help ;)

Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘CSS’ is closed to new topics and replies.