Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Fitting 9 100px wide boxes into 900 px div...

Featured Replies

Hi, im trying to fit 9 100px wide boxes into a 900 px div, but for some reason the last box always goes out of the container div. Im using display:inline-block for the child boxes. I tried with display:inline, but this just makes the divs go to 0 height. If i make the container div longer than 900px thou it all the boxes will fit for some reason.

 

Anyone know whats up?

 

Thanks!

  • Author

Have the boxes got borders?

 

No... here is the code:

 

.topPanel .topBar .menuBar {margin-left:auto; margin-right:auto; padding-top:10px; height:80px; width:980px;}
.topPanel .topBar .menuBar .menuItem {display:inline-block; height:80px; width:100px; margin-right:10px; background-color:Aqua;}
.topPanel .topBar .menuBar .lastMenuItem {display:inline-block; height:80px; width:100px; background-color:Aqua;}

 

menuBar is the container, and menuItem is the child box. lastMenuItem is the last box in the lineup and it has no padding.

  • Author

I noticed it adds some spacing between one div and the other but it isnt a margin or a border, just plain white space, maybe that is the problem? How do i remove it?

 

unnnnled.jpg

They have a 10px margin to the right, as per the code you just supplied

 

Also, try adding margin: 0px to the menus items

 

.topPanel .topBar .menuBar {margin-left:auto; margin-right:auto; padding-top:10px; height:80px; width:980px;}
.topPanel .topBar .menuBar .menuItem {display:inline-block; height:80px; width:100px; margin-right:10px; background-color:Aqua;}
.topPanel .topBar .menuBar .lastMenuItem {display:inline-block; height:80px; width:100px; background-color:Aqua;}

Edited by roothost

This is a whitespace issue if you have all your menuitems on the same line

 

<li class="menuItem">1</li><li class="menuItem">2</li><li class="menuItem">3</li>

 

instead of

 

<li class="menuItem">1</li>
<li class="menuItem">2</li>
<li class="menuItem">3</li>

 

You'll see the difference

Sorry didn't realise you were looking for a solution just thought you were wondering what caused it

 

Christopher is correct use float

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.