Width auto results in larger width than the sum of children's width

Benvaulter

I am currently trying to construct a basic CSS-layout for myself, where I want to deploy an expandable menu that pushes the rest of the content out of the screen (or the container). To do so, I used the white-space:nowrap. I am then planning to manipulate the width of the menu-div, which works fine for me. However, some sort of padding or margin appears to be applied between the child-divs in the container and I can't find a way to get rid of them. Could you help me out here? i would also like to understand what causes this issue. Many thanks in advance!

CSS:

html{
    margin:0;
    padding:0;
    font-family: 'Open Sans', sans-serif;
}
body{
    margin:0;
    padding:0;
}
#container{
    width:1024px;
    height:768px;
    background-color:#000;
    overflow:hidden;
    white-space:nowrap;
}
#icons{
    width:30px;
    height:100%;
    display: inline-block;
    background-color:#9e971f;
}
#menu{
    width:100px;
    height:100%;
    display: inline-block;
    background-color:#1f939e;
}
#top{
    height:40px;
    width:100%;
    display: inline-block;
    vertical-align: top;
    background-color:#1f3f9e;
}

HTML:

<div id="container">
    <div id="icons"></div>
    <div id="menu"></div>
    <div id="top"></div>
</div>

FIDDLE

TijmenBrx

Using float: left;should work:

http://jsfiddle.net/hjLdrjzx/

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

parent div's width larger than children's width in Firefox

From Dev

Child element auto width (larger than parent)

From Dev

Why is width of page larger than screen width?

From Dev

Auto percentage width based on children

From Dev

CSS: how to set width to children's width?

From Dev

CSS: how to set width to children's width?

From Dev

image width 100 % when the height larger than the width with JQuery

From Dev

CSS auto change ul width; fit to MINIMUM width of children inline-block li's?

From Dev

CSS: 100% is larger than page width?

From Java

why is textarea larger in width and height than iframe?

From Dev

tkinter wrap text if larger than column width

From Dev

Measure width and height of a layout larger than the screen

From Dev

Inner Div with larger width than outer div

From Dev

tkinter wrap text if larger than column width

From Dev

Measure width and height of a layout larger than the screen

From Dev

Table auto scrolls when its cells are larger than body width and height

From Dev

Table auto scrolls when its cells are larger than body width and height

From Dev

Strange effect when sum of the column width is larger than 12 in Bootstrap3?

From Dev

Strange effect when sum of the column width is larger than 12 in Bootstrap3?

From Dev

Container's width not wrapping around width:auto <video>

From Dev

Element not taking up children's width

From Dev

Element not taking up children's width

From Dev

Why main activity frame width is larger than height even if it's in portrait mode?

From Dev

Make element width stretch to fit its children when element's parent has overflow: auto;

From Dev

Expanding parent div to child size when larger than page width

From Dev

Is right shift undefined behavior if the count is larger than the width of the type?

From Dev

Find all elements with width larger than xxx and output them to console

From Dev

Find all elements with width larger than xxx and output them to console

From Dev

Resizable img within a p tag, that has a larger width than container

Related Related

  1. 1

    parent div's width larger than children's width in Firefox

  2. 2

    Child element auto width (larger than parent)

  3. 3

    Why is width of page larger than screen width?

  4. 4

    Auto percentage width based on children

  5. 5

    CSS: how to set width to children's width?

  6. 6

    CSS: how to set width to children's width?

  7. 7

    image width 100 % when the height larger than the width with JQuery

  8. 8

    CSS auto change ul width; fit to MINIMUM width of children inline-block li's?

  9. 9

    CSS: 100% is larger than page width?

  10. 10

    why is textarea larger in width and height than iframe?

  11. 11

    tkinter wrap text if larger than column width

  12. 12

    Measure width and height of a layout larger than the screen

  13. 13

    Inner Div with larger width than outer div

  14. 14

    tkinter wrap text if larger than column width

  15. 15

    Measure width and height of a layout larger than the screen

  16. 16

    Table auto scrolls when its cells are larger than body width and height

  17. 17

    Table auto scrolls when its cells are larger than body width and height

  18. 18

    Strange effect when sum of the column width is larger than 12 in Bootstrap3?

  19. 19

    Strange effect when sum of the column width is larger than 12 in Bootstrap3?

  20. 20

    Container's width not wrapping around width:auto <video>

  21. 21

    Element not taking up children's width

  22. 22

    Element not taking up children's width

  23. 23

    Why main activity frame width is larger than height even if it's in portrait mode?

  24. 24

    Make element width stretch to fit its children when element's parent has overflow: auto;

  25. 25

    Expanding parent div to child size when larger than page width

  26. 26

    Is right shift undefined behavior if the count is larger than the width of the type?

  27. 27

    Find all elements with width larger than xxx and output them to console

  28. 28

    Find all elements with width larger than xxx and output them to console

  29. 29

    Resizable img within a p tag, that has a larger width than container

HotTag

Archive