Javascript 如何使用CSS调整jQuery加载方法加载的内容大小
我正在使用加载方法加载网站中的网页Javascript 如何使用CSS调整jQuery加载方法加载的内容大小,javascript,jquery,Javascript,Jquery,我正在使用加载方法加载网站中的网页 // main.js $(document).ready(function () { $("#content").html("<object data='http://tired.com/'>"); }); // index.html <html> <head> <script src="http://code.jquery.com/jquery-1.7.2.min.js"></scr
// main.js
$(document).ready(function ()
{
$("#content").html("<object data='http://tired.com/'>");
});
// index.html
<html>
<head>
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script src="scripts/main.js"></script>
<style type="text/css">
#container{
width: 100%;
height: 100%;
}
#content{
margin-top: 10;
margin-left: 100;
margin-bottom: 10;
margin-right: 10;
width: 500px;
height: 500px;
}
</style>
</head>
<title>
Testing loading a html page into a div
</title>
<body>
<div id="container">
<div id="top">
<p> Top </p>
</div>
<div id="content">
</div>
<div id="bottom">
<p> Bottom </p>
</div>
</div>
</body>
</html>
尽管给内容div一个500px的高度和宽度,网页仍然以其原始大小加载
我怎么把它弄大
谢谢。我建议尝试在对象标记本身上设置样式:
#content object {
width: 500px;
height: 500px;
}
它确实有用,检查一下这把小提琴。 您可能还希望将px添加到您的页边距中
#content{
margin-top: 10px;
margin-left: 100px;
margin-bottom: 10px;
margin-right: 10px;
background:skyblue;
width: 500px;
height: 500px;
padding:10px;
}
您在哪里将内容设置为500px宽或高?我只看到90%,这将与您的浏览器的规模。“高度百分比”设置也可能无法像您预期的那样工作。对不起,我两个都试过了。它仍然只加载原始大小。我将在问题中解决它。