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,

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

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.

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 :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.