Why in this page ( http://nap-sa.ro/html) , using IE6, some divs don`t look ok?(In IE7 and Firefox they are displaying correctly!)

Dani AI

Generated

Browsers differ in subtle layout rules; IE6 in particular has a handful of quirks that make otherwise-correct markup break. The replies here point in the right directions — flags messy markup, alludes to spacer/empty tags — so start by treating those as leads and then follow the targeted checks below.

Validate markup and DOCTYPE first. Run the page through the W3C HTML validator and fix unclosed tags, stray elements, or invalid nesting. Ensure a modern standards DOCTYPE is present so IE does not fall into quirks mode (missing/old DOCTYPE often changes the box model).

Isolate the problem with a simple workflow: temporarily add visible backgrounds/borders to suspected containers, then remove or comment CSS in large chunks (binary search) until the layout becomes correct. That will tell whether the fault is in a parent container, a float, or a positioned element.

Common IE6-specific fixes that solve many symptoms:

  • Trigger IE’s layout on a container to fix containment and rendering (apply zoom:1; or set an explicit width/height or overflow:hidden on the container).
  • Fix the IE6 double-margin-on-floats bug by adding display:inline; to the floated element.
  • Contain floats by creating a block formatting context (overflow:auto / overflow:hidden / display:table / zoom:1).
    These are small, local fixes — prefer them over sprinkling spacer elements in the HTML.

If IE6 support is required, wrap fixes in an IE-only stylesheet using conditional comments so modern browsers are unaffected. If support can be dropped, remove the hacks and simplify the CSS. For general layout concepts (floats, box model, containing floats) see MDN’s guides on the box model and floats: and float.

Recommended Answers

All 3 Replies

Because HTML and CSS code is very big and bad.

E.g. (     ...)
This only one example.

Install bugs on your browsers

Empty tag pairs are not allowed. Different browsers waste them in different ways.

Use styles to create blank spaces, instead of p tags with nonbreaking spaces inside.

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.