Forum Moderators: not2easy

Message Too Old, No Replies

position text left, float img right

         

ukgimp

3:55 pm on Sep 11, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello

I am trying in vain to get a div to have floated log right and some text left that is positioned vertically in the div.

----------------------------------------
...............................logo
Text.........................logo
...............................logo
---------------------------------------

if you ignore the "." you get the picture.

The text is h1, is this possible. I keep getting big gap for the logo, either that or some other not required positioning. Sorry for the code drop.

//###########

.logo {float:right}

#divone {
width: 100%;
background-color: #4a4284;
vertical-align: middle;
padding-right: 3px;
padding-left: 3px;
padding-top: 0px;
padding-bottom: 0px;
color: #FFFFFF;
}

#divone h1 {
display: inline
}

<div id="divone">
<H1>some text</H1><img src="img/logo.gif" class="logo">
</div>

Reflection

4:21 pm on Sep 11, 2003 (gmt 0)

10+ Year Member



Try putting the img before the h1 tag in your html.

TGecho

4:48 pm on Sep 11, 2003 (gmt 0)

10+ Year Member



Also if you put the image inside your H1 then tell "h1 img" to float:right, that should do it with a minimum of html

SuzyUK

5:17 pm on Sep 11, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



also you may like to try positioning, float will do it but the image will need to appear first in the code which you may not want..

<h1 id="one">some text<img src="img/logo.gif" class="logo"></h1>

position the h1 relatively, give it the same height (and line-height if you want it to centre vertically) as the logo image

then position the image absolutely inside the h1 - top: 0; right: 0; or whatever suits

Suzy

ukgimp

8:50 am on Sep 12, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How simple

Switching them worked a charm.

Thanks