0

Hi all,
I have a div where I would like to move the text inside it away from the border. A quick google found that I should use padding-left.

However, it doesn't seem to work (i've tried Safari and Firefox in case it was a browser issue). What have I missed?

#text-right2
{
	position:absolute;
	top:0px;
	right:0%;
	width:33%;
	height:80%;
	padding-left:20px;
}

Cheers,

3
Contributors
3
Replies
5
Views
7 Years
Discussion Span
Last Post by bsewell
0

zero has no dimension, 0px is 0em is 0pt is just 0,
you cant set an absolute width and expect padding to always work, if the text comes to less than 20px of the element width and there is not a place where the text can break, it wont break
height:80% wont always work either, page height is not a constant, not defined untill the page is rendered, window height is different between browser versions
browsers into quirks modes that act unpredictably
try

#text-right2 { position:absolute; top:0; bottom:auto; right:0; left:auto; width:33%; height:80%; padding-left:20px; }

still will not work in all browsers

0

Hi all,
I have a div where I would like to move the text inside it away from the border. A quick google found that I should use padding-left.

However, it doesn't seem to work (i've tried Safari and Firefox in case it was a browser issue). What have I missed?

#text-right2
{
	position:absolute;
	top:0px;
	right:0%;
	width:33%;
	height:80%;
	padding-left:20px;
}

Cheers,

Try removing your absolute position. It may be locking the text.

0

I tried both solutions in both Firefox and Safari but they didn't work.

In the end, I found a better solution to fix the issue. I had another div below this div, which was transparent so I just changed the dimensions of the div I was trying to set padding-left to.

Thanks for your help anyway :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.