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.

Help with floats?

Featured Replies

Hello there,

 

I'm trying to create a liquid header using a 1px wide image and a left and right float for the corner images. The problem is i'm using transparent png's and need to position them on the ends of the div container instead of overlapping. (to give them the same transparency)

 

Any insight?

 

<style type="text/css">

body {

font: 80% verdana, arial, helvetica, sans-serif;

text-align: center; /* for IE */

background-color: #333333;

background-image: url(Images/circuit-gradient-380x1050.jpg);

}

#container {

text-align: left; /* counter the body center */

width: 80%;

background-image: url(Images/xrepeatheader.png);

background-repeat: repeat-x;

height: 108px;

margin-right: auto;

margin-left: auto;

}

#container #leftcorner {

background-image: url(Images/leftcornerheader.png);

float: left;

height: 108px;

width: 27px;

}

#container #rightcorner {

background-image: url(Images/rightcornerheader.png);

float: right;

height: 108px;

width: 27px;

}

</style>

</head>

<body>

<div id="container">

<div id="leftcorner"></div>

<div id="rightcorner"></div>

</div>

 

</body>

</html>

 

Thanks for your help!

Not entirely sure the exact output of this one, but your HTML and CSS seems okie to achieve the desired effect. You may want to put

 

overflow: hidden; in your container div just incase the browser just gets that little bit too small.

 

So the corners are appearing out of whack, because they are transparent yeah? They are in the right position, but the vertical repeating graphic in container is kind of wiping out your corners?

 

If thats a wrong assessment please post an image it would really be a lot easier.

 

Another way around this issue if it is the case,

 

is to have 5 divs in total,

 

#container

 

#hdrLeft

 

#cornerLeft

 

#hdrBg

 

#hdrRight (essentially corner right)

 

this way your middle graphic is limited to only the space between the sides as opposed to going to the background of the corners

 

 

Just float all the divs to the right positions using similar CSS to what you have done already.

 

This is far from optimised, its actually pretty sloppy. Another option you could do is have an unordered list for your head - a little unconventional but you could just apply ids to list items and make it work that way.

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.