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 control

Featured Replies

ok so i am having some trouble getting my divs in the right place,

 

i have drawn up a basic example to demonstrate here goes:

 

basically i want divs inside divs, and this is proving troublesome

 

 

 

here is some basic code i just put down to demonstrate:

 

<html>

<style type="text/css">
<!--
#wrapper {
width: 500px;
margin: auto;
text-align: center;
}
#left {
float: left;
}

#right {
float: right;
}


-->
</style>
</head>


<div id="wrapper">text in wrapper
 <div id="left">left</div>
 <div id="right">right</div>
</div>

</html>

 

(i have made the styles inside rather than extrnally for ease)

 

and im expecting to have a box 500px wid with 2 boxes inside it but this is what i get:

post-6625-1218135888_thumb.jpg

(you can only just see it lol)

 

i have put the "wrapper text" in to illustrate it position

 

tia

your boxes are inside the div....if they weren't the left div would be the very left of the screen and the right the very right

 

now if you want things in the middle between the two divs you will need to make a third. Also you will have to set a width for the divs, example:

 

<html>

<style type="text/css">
<!--
#wrapper {
width: 500px;
margin: auto;
text-align: center;
}
#left {
float: left;
width:200px
}

#right {
float: right;
width:200px
}

#middle {	float: left;
width:100px}

-->
</style>
</head>


<div id="wrapper">
 <div id="left">left</div>
 <div id="middle">
<p>test</p>

 </div>
 <div id="right">right</div>

</div>

</html>

 

 

 

Now if you have a background in your wrapper to get that to span all the way down you need to add this to the after the close of the right div:

<div style="clear:both"></div>

 

and that will force the wrapper down. However this only works when you are using floats.

 

 

However a little note, don't trust what you see in design view of dreamweaver always do tests in browsers as design view isn't always a good indication of how the site will look :)

NEVER trust what you see unless it's being rendered by the browser.

 

overflow: auto; will make them (look) like they're in the main container. Like dizi says, give the left and right a width.

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.