Forum Moderators: not2easy

Message Too Old, No Replies

line height problem with image.

         

adamnichols45

10:50 am on Nov 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have abit of a problem really bothering me.

I have 2 lines

top line - blahblah blah 123
bottom line - blahasoau uo 1234 - <img src="ex.gif">
only problem is the image is taller than the text.

but I want to reduce the gap between the 2 lines.

hope that makes sense.

I have tried all manner of things but the only thing that works is removing the image - not good lol

swa66

12:49 pm on Nov 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So exactly what do you want to happen ?
something like


top line - blahblah......+------+
blah 123.................¦......¦
bottom line - blahasoau..¦......¦
uo 1234..................+------+

could be achieved by moving the image to the first line and floating it right

If you'd rather risk the text of the first line running into the image, you could set negative margins on the second line.

adamnichols45

8:19 pm on Nov 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I tried a negative setting but othing happened.

basically i want the top 2 line of text

on the third line is more text followed by an image of 5 stars. they go slightly above the text in the height so im left with the top 2 lines nicely spaced but the third line text is to far below because of the image on that line. I want to move the bottom line so it is nearer the 2nd line.

swa66

8:54 am on Nov 12, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try this:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/x
html1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>untitled</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
p {
background-color:green;
}
p img {
height: 30px;
width: 50px;
display: inline-block;
margin-top: -20px;
}
</style>
</head>
<body>
<p>first line<br />
second line <img src="1.jpg" />.</p>
</body>
</html>

Note that I had to use display: inline-block and that it might not work all that great in the older versions of firefox still in use (it works in FF3, safari, opera and even in IE7 and IE6)

adamnichols45

8:17 pm on Nov 12, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks mate. I auctually tried the negative value again and it was doing What I intended I will do some more testing though.

Many thanks I can now finally move on lol.