/    Sign up×
Community /Pin to ProfileBookmark

div goes on forever in IE 8.0

My doctype is:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN” “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd“>

If I put a div on a page like this:

[CODE]<div style=”width:400px;”>
<p>Some content here that may go on for quite a bit, in fact it may be a very long sentence, one that makes no sense really etc.</p>
</div>[/CODE]

If I view that in IE 8.0 – the div width is ignored – and the text in the <p> tag does not wrap. If the text is long enough it forces the div way off the screen to the right.

What is it with IE – can’t they get ANYTHING right? Does anyone know the fix for this? (Look at it in compatability mode and the div is the right width).

Thanks for any help.

to post a comment
CSS

3 Comments(s)

Copy linkTweet thisAlerts:
@testerAug 19.2011 — I think this will solve the problem
[code=html]<div style=" position:absolute;width:400px;">
<p>Some content here that may go on for quite a bit, in fact it may be a very long sentence, one that makes no sense really etc.</p>
</div>[/code]
Copy linkTweet thisAlerts:
@rtretheweyAug 19.2011 — No, setting the position to absolute won't help. The problem must be someplace else in your code. Whatever its faults, IE handles basic element sizes properly. Try the following in your browser and see what happens:

<i>
</i>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Test&lt;/title&gt;
&lt;style type="text/css"&gt;
div { background-color:white; }
&lt;/style&gt;
&lt;/head&gt;
&lt;body style="background-color:#c0c0c0;"&gt;
&lt;div style="width:400px;"&gt;
&lt;p&gt;Some content here that may go on for quite a bit, in fact it may be a very long sentence, one that makes no sense really etc.&lt;/p&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
Copy linkTweet thisAlerts:
@WebskaterauthorAug 19.2011 — Yes, as you say, that works okay - and thank you for your reply.

My real situation is a bit more complicated ... I have a load of divs at the bottom of a page that contain 'help files'. Users pop them up by clicking on links at various positions on the page and a javascript function is called to size and position the div that pops up. Been using the same code for years and it's always worked fine in IE, Firefox and (more recently) Chrome.

But, in IE 8.0 the 'help file' text inside the div goes on forever. If you switch to compatability mode the problem goes away. I was hoping someone would say ... 'yes in IE 8.0 you need to do this ...'

I'll dig out and post the code.
×

Success!

Help @Webskater spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...