我尝试根据脚本加载的内容来扩展页面的内容 div。我已经尝试了我所知道的一切以及我在互联网上找到的一切,但没有任何结果是我想要的。
HTML:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>index</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript">
$(function(){
$('#nav a').click(function(e) {
$('#content').hide().load( $(this).attr('href') , function(){
$('#content').show()
})
return false
})
})
</script>
</head>
<body>
<div id="container">
<div id="header"></div>
<div id="nav"><a href="home.html">Home</a>
<a href="the_band.html">The Band</a>  
<a href="News.html">News</a>  
<a href="gallery.html">Gallery</a> Merchandise
<a href="contact.html">Contact</a></div>
<div id="content"></div>
<div id="footer"></div>
</div>
</body>
</html>
CSS:
div#container {
height: 100%;
width: 100%;
}
div#header {
top: 0px;
width: 100%;
height: 80px;
position: fixed;
background-color: transparent;
text-align: center;
}
div#nav {
font-family: MgSouvenirLight;
font-size: 18pt;
color: #FF0;
top: 120px;
width: 100%;
height: 40px;
position: fixed;
text-decoration: none;
text-align: center;
font-weight: bolder;
font-variant: normal;
}
div#content {
font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
font-size: 12px;
position: absolute;
top: 200px;
bottom: 40px;
left: 200px;
right: 200px;
}
div#footer {
font-family: Arial, Helvetica, sans-serif;
font-size: 9px;
bottom: 0px;
position: fixed;
height: 30px;
width: 100%;
text-align: center;
color: #fff;
}
.ttdesign {
font:"Arial Black", Gadget, sans-serif; color: #09F;
}
a:link {
font-family: MgSouvenirLight;
font-size: 18pt;
color: #FF0;
}
a:visited {
font-family: MgSouvenirLight;
font-size: 18pt;
color: #FF0;
}
a:hover {
font-family: MgSouvenirLight;
font-size: 18pt;
font-style: italic;
color: #FC0;
}
演示链接是:http://thodoris.esy.es/is/
现在,出现的问题是加载的内容不会使#content 展开,但它似乎加载了它...有什么想法吗?
最佳答案
如果您希望您的页面具有响应性,您最好使用 bootstrap,因为使用那里的网格系统可以让您根据内容和屏幕尺寸使页面的所有方面都具有响应性。
可以得到here
这里有一些免费模板向您展示它们是如何组合在一起的here
关于html - 根据内容展开div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27066264/