Is using -100px or minus however many pixels considered as bad coding practise, should it be avoided? Do employers look down upon this?

Example Use:

<div style="margin-left:500px; margin-top:-85px;"> 
<p>Home | About | Contact</p>
</div>

Recommended Answers

I recently faced a similar issue when I was learning about page layout using CSS.

As I understand it, and I may not be understanding it fully or correctly, when you are using relative positioning, you can use negative margins. That is because the margin anchor (top left) will …

Jump to Post

All 2 Replies

I recently faced a similar issue when I was learning about page layout using CSS.

As I understand it, and I may not be understanding it fully or correctly, when you are using relative positioning, you can use negative margins. That is because the margin anchor (top left) will be that of the base element's position. If you wanted an element to be higher than or to the left of the base element, then you would use negative margin values.

In very rare cases I use negative margins. My employer does not mind it. He tells as long as the output is same in all the browsers.

Be a part of the DaniWeb community

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