i m new to coding a style sheet by hand.i did a website with positioning all the elements by adjusting their margins,some settles in the desired place automatically.now , i use
absolute positioning, but for this i need to arrange each and every element . i do not know
what is the best practice for positioning a element ? help me out....

Recommended Answers

All 2 Replies

Absolute positioning can be a real headache, particulary with resizing the browser window. You should be able to use position: relative to position child elements within their parent with few problems. You will still get some movement between the browsers though.
Are you using a CSS browser reset to clear out all margins and paddings before you begin? That can help.

You can center a web page by applying "margin:auto 0 auto 0;" to the main page div, and then float other content within it. If you have two or more boxes across the page float each one to the left and apply left or right margins to each to position them exactly where you want them. You have to make sure that the box width plus each margin is a little bit less than the page or the last one will wrap to the next row.

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.