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.

Please help me with CSS/XHTML Layouts with floating

Featured Replies

Hello everyone! This is my first post here.

 

Unortunatly I am having a rather MINOR but FRUSTRATING issue.

 

I have made a layout using xhtml/css to make a prototype front page.

 

Refer to the attachment 'Prototype Site' which contains index.html and main.css

 

Now, the layout SO FAR is fine for me. However if you look at the 'contentwrapper' div and all of its containing elements, such as shown in the picture3.png attachment you will see that i have succeeded in using floats to my advantage to get both columns on either side of the contentwrapper div.

 

HOWEVER, for the life of me I cannot preserve the background colour of the 'contentwrapper' div. I want it to be LIGHT BLUE. However it is showing up as WHITE.

 

I want to be able to type in both columns and still have a blue contentwrapper background. Because, for example, the right column might be less height than the right, and so I will expect a blue background to be there.

 

Please can someone help me because I have been many hours fiddling with the position and float values and have had no results yet. Thankyou!

 

Steve

Prototype_Site.zip

post-6909-1220548004_thumb.png

  • Author

Also, this picture attachment shows what I want the whole page to do (layout only)

 

And just to point out:

 

i can preserve the background if i have a div on it

 

and i can preserve the background of a wrapping div if another div element is inside it

 

However, once i use the float function, the background turns white.

 

So frustrating!

post-6909-1220549435_thumb.png

You have to clear your floats with another div (or the html element of your choice) like this:

<div id="left">...</div>
<div id="right">...</div>
<div class="clear"></div>

and the css for the clearing div:

.clear { display:block; clear:both; }

That will expand the container div / wrapper.

  • Author
You have to clear your floats with another div (or the html element of your choice) like this:

<div id="left">...</div>
<div id="right">...</div>
<div class="clear"></div>

and the css for the clearing div:

.clear { display:block; clear:both; }

That will expand the container div / wrapper.

 

Quick question, does that html need to be inserted after ALL the divs (the last div) inside the container div, regardless of whether they are floating or not, or do I need multiple divs in a container after each floating div?

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.