How to code css properly ,so the site to be the same over all resolutions and browsers? I think that I should have one center box ,where will my html be and one outer div that will expand.Am I right?

  • I mean how to position elements properly that the site layout to be the same under all resolutions and browsers.I know that position:absolute doesn't work in this case. But what is the best way?Margins?Paddings?Or position:relative? lam3r4370 almost 6 years ago

2 answers

1
point

Some basic tips would be to always use a thorough reset, test in a modern browser (like Firefox) first and then check it in other browsers, don't write excessive or redundant code, and just stay organized. IE will definitely give you hell so be prepared for that.

Answered almost 6 years ago by Matt Milburn
Sisira 95
1
point

From description of your question, i found you wanted to know how we can code better from HTML and css point of view. The basic steps would be as follows

  1. Code your HTML markups first with the desired wrapper divs and semantic code approach
  2. The wrapper divs can be center aligned through css. e.g for the first wrapper div with id (contentWrapper) with width 800px to be centered in browser you need to put the following style in style sheet

    contentWrapper

    { margin:0 auto; width:800px }

  3. For code your css, you need to put the reset css which is reset for the different browser different attribute vlaues(you can get yahoo reset css)

  4. Write the rules for css in alphabetical order of attributes.

  5. Remove the semicoln from the last rule it optimises your style sheet

Please see the sample code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> Sample Code - Example

First heading

Second heading

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

Note that the embed css should be externilised.

Answered almost 6 years ago by Sisira
  • Thank You!I updated my question. lam3r4370 almost 6 years ago