...

View Full Version : positioning text and width problem



docock
07-16-2011, 06:15 PM
I've got an image from 196x196 px on my website.
I've placed aa 196x30 px transparent div on top of it, on the bottom of the image.

For some strange reason the transparent div hasn't got a width from 196px, how can I alter the coding so that the width will be 196px ?

Second, how can I vertical align the text ? It looks okay on IE now, but if I test it with firefox the text is too high. I know I can set a margin for it, but then the text in IE would be too low.




<html>
<head>
<style type="text/css">

div.transbox
{
width: 169px;
height: 30px;
margin: -37px 0px;
background-color: lime;
border: 0px solid black;
filter:alpha(opacity=60);
opacity:0.6;
position: relative;

}
div.transbox p
{

margin: 5px 0px;
font-weight: bold;
color: #000000;
text-align: center;

}
</style>
</head>
<body><div><img src="fcd4-3f08.jpg">
<div class="transbox">
<p>example text</p>
</div></div>
</body>
</html>

Sammy12
07-16-2011, 07:28 PM
oh nice. so your trying to make an opacity filter.

I would suggest absoluting the filter over the image.

To vertical align: use line-height: (height of img) - line-height and height are the same measure, so you are setting an equal padding on the top and bottom.

You could also use vertical-align http://www.w3schools.com/cssref/pr_pos_vertical-align.asp but I've always hated this :)



div.transbox {
width: 169px;
height: 30px;
margin: -37px 0px;
background-color: lime;
border: 0px solid black;
filter: alpha(opacity=60);
opacity: 0.6;
position: relative;
}


196!

line height would be :



line-height: 3px0;


-best regards



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum