Ok so I have been programming for like 2 years, and im not rich enough to buy my own domain so i use freewebs... anyway i have a problem with css in ie. Is this a natural problem with ie? Is there anyway to make css class definitions compatible? etc... The site i am having trouble with is http://www.freewebs.com/mattrandompoems/ Thanks!

Dani AI

Generated

Good catch by — a malformed HTML comment can break the parser and make IE render a different DOM, which often looks like a CSS bug. Browsers recover from invalid HTML in different ways; older IEs are especially prone to producing layout problems when the markup is invalid rather than when the CSS itself is wrong. That explains why the page looked fine in some browsers but not in IE.

Practical checklist to diagnose and avoid this in future:

  • Validate the published HTML with the W3C Validator to catch stray or malformed markup early.
  • Confirm what the browser actually receives (host wrappers like Freewebs can inject extra HTML). Use "View Source" or the browser devtools to inspect the final DOM and computed styles.
  • Reduce to a minimal test case: remove everything but the problematic element and its stylesheet, then reintroduce pieces until it breaks.
  • Make sure a proper standards DOCTYPE is present so the page runs in standards mode (see DOCTYPE on MDN and Quirks versus standards mode).

Short-term IE-specific fixes (conditional styles, targeted rules) exist, but they should be a last resort. Fixing the underlying HTML and adding validation to the workflow prevents most cross-browser surprises — as pointed out, doctype and valid markup are the right places to start.

Recommended Answers

All 2 Replies

there are specific "hacks" and general hack methods, but needing to hack is often a sign of a deeper underlying issue.

do you use a doctype? (some) problems with CSS can be solved by using an up-to-date document type specification... if something looks ok in Firefox, Opera and the like, but not in IE, sometimes it's a doctype issue, sometimes its an IE issue, sometimes it's a developer choice issue.

can't really help you more than that.

oh, that and some links:

http://alistapart.com/stories/doctype/
http://www.htmlhelp.com/tools/validator/doctype.html

Ok so apparently the problem was just me being a idiot programmer,
in my code i had comments shown as

<!--Comment--!>

When it should have been

<!-- comment-->
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.