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.

Div Problem

Featured Replies

So I have started making my first site with Div tags and looked everywhere for a decent answer and cant find one anywhere, I have tried positioning the div Absolute and relative but the div wont move. It's driving me crazy.

 

My code:

 

CSS:

 

#navbar {
margin:0px auto;
width:1020px;
height:36px;
background:url(images/navbar.jpg) no-repeat;
}
HTML:
<body>
<div id="banner"></div>
<div id="navbar">
<div id="home"><img src="images/home.jpg" width="100" height="31" /></div><div id="about"><img src="images/about.jpg" width="100" height="31" /></div></div>
<div id="content"></div>
<div id="bottom"></div>
Outcome: attached.
If anyone can help then I would really appreciate it, remember I am a beginner and looking for constructive feedback if possible :)post-61040-0-05669400-1396042135_thumb.jpg

 

  • Author

hi, it seems that the home div and about is not in "float:left" or "display:inline-block"

 

 

So would I put display:inline-block at the start of each div in the CSS?

 

Thanks :)

Block elements (like divs) own 100% of the width (unless they are set to float), even if you specify a width there is always a "line break" after a block element. The next element wil therefore be placed in the availeble space below. the solution is, as suggested by d3vinefist, either to float them or change their display property (to inline-block, inline or table-cell)

Create an account or sign in to comment

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.