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.

Positioning my Divs

Featured Replies

Hi,

 

I am currently trying to get something working on my site.

 

At the moment, my code is as shows:

 

<div class="maintop">
<div class="lefttop"><h1><?php echo $config['sitename']; ?></h1><h2><?php echo $config['tagline']; ?></h2></div>
<div align="righttop"><h1>Login Form Here</h1></div>
</div>

 

Defined in my css, is as follows:

 

.lefttop{
float:left;
}
.righttop{
float:right;
}
.maintop{
display:inline;
}

 

Both layers (defined "left" and "right" sit on below the other), is there something I'm missing?! :wacko:

close the other div, you only 3 closing div tags.

 

Also float the right one left and itl be to the right hand side of the left if thats any good...

Yep, you need some widths. If you don't specify any, the browser will assume you mean 100%. That's why the divs are stacking on top of each other.

Does the left one actually need a float?

 

Not necessarily I suppose - it might seem a bit "belt and braces" but float and width will ensure the parent container's height adjusts to the content inside it.

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.