Load file jQuery load with css inside the file
Imagine this small code
$(document).ready(function() {
$("#loadingDiv").load("sub/__window_div.php");
})
It runs okay in Chrome开发者_Go百科, Firefox, Opera, Safari and IE8 (yes!). But if I add some CSS in the __window_div.php
file, it stops running in IE8, but runs fine on other browsers.
I just add in the file those lines:
<style type="text/css">
</style>
Is it not possible to have CSS in the include file? Why only IE8 doesn't load the file?
No, it is not valid to have
<style></style>
elements in any part of your HTML other than inside the<head></head>
tags.Other browsers have managed to handle it, but as I said, the
style
element must be present only insidehead
tags.
You can not but in the body.
You should try to add your style directly in the tag with style="" attribute.
Or you should have your style included in the css of the calling page. The style will be applied on the loaded content.
精彩评论