apscience
apscience

Reputation: 7273

Make element not take up more space than it's allocated

I have a sidebar with a set width and height. The problem is, it's supposed to be on the right but it takes up space on the left too like a block. However, I've set the display to inline but that doesn't seem to fix the problem. How can I make the div take up no space on the left?

Part of the CSS:

div#sidebar {
    float: right;
    width: 256px;
    height: 500px;
    display: inline;
    clear: none;
}

JSFiddle for the whole page: http://www.jsfiddle.net/9tW2U

Upvotes: 0

Views: 286

Answers (1)

SKeurentjes
SKeurentjes

Reputation: 1878

The width of either #sidebar or #mainbox is 3px to big to fit next to each other in #page. Take 3px of the width of #sidebar or #mainbox and it will fit.

By the way, display: inline doesn't have anything to do with it because you are allready using floats.

Upvotes: 1

Related Questions