[英]How to set width dynamically for included .html file
我已经设计了主页,并使其成为一个单独的index.html文件,并且我还有很多其他页面,
这些页面执行一些操作,但是我没有为这些页面设计UI。 并且我在所有这些页面中都包含了index.html文件。现在我正在获取背景。
但是发生的是,当我增加某些页面内容的宽度时,宽度正在增加,但是index.html的宽度未得到应用。
它看起来像这样
--------------------
| index.html |
| --------------------
| | |
| | |
| | other page |
| |__________________|
--------------------
当我增加另一页的宽度时,index.html页的宽度也应增加。
我怎样才能做到这一点
index.html的代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<title>X---todo---X</title>
<head>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<div class="frame">
<div class="backbody">
<div class="header">
<img src="images/logo.png" class="logo">
<table border="0" class="tabs">
<tbody>
<tr>
<td>
<div class="mitem1"><span class="mitem"><a href="#">mq</a></span>
</div>
</td>
<td>
<div class="mitem1"><span class="mitem"><a href="#">mb</a></span>
</div>
</td>
<td>
<div class="mitem1"><span class="mitem"><a href="#">m6</a></span>
</div>
</td>
<td>
<div class="mitem2"><span class="mitem"><a href="#">ml</a></span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="body"></div>
<div class="footer"></div>
</div>
</body>
</html>
有关HTML的CSS
body{
}
.header{
background:rgba(10, 10, 10, 0.64);
height:110px;
width:100%;
}
.backbody{
background:url(../images/aya.jpg);
width:100%;
height:520px;
}
.footer {
background: none repeat scroll 0 0 #333333;
color: white;
height: 60px;
position: relative;
width: 100%;
}
.body{
width:100%;
height:700px;
}
.frame {
box-shadow: 3px -2px 10px;
height: auto;
position: relative;
width: 100%;
}
.mitem > a {
color: white;
font-size: 80%;
font-weight: bold;
text-decoration: none;
}
.mitem1:hover{
background:#E07F1D;
width:auto;
color:black;
border-radius:10px;
}
.mitem2{
background:#E07F1D;
width:auto;
border-radius:10px;
}
.mitem1,.mitem2 {
padding: 6px 20px 7px 20px;
}
.tabs {
position:relative;
top:48px;
left:-15px;
float:right;
}
.logo{
position:relative;
left:20px;
}
谢谢大家.. :)我终于找到了使用jquery的解决方案...
实际上,jsp页面包含动态扩展的表。
当表格动态增加时,背景的高度也应增加。
所以我想到了使用jquery动态设置背景高度
我使用的算法是:
on document ready
step-1 > get the height of particular table
step-2 > add some default given value with height value
step-3 > get the added value and set that value to reset the background height..
it worked quite really good....
和我同样适用于宽度,也有一些小的变化.....
工作真的很好...
我不是JSP的“ foendi”,但是这全都归结为html和css,并且知道如何正确使用布局。
在我看来,您的索引页具有固定的宽度。
为了解决这个问题,这就是我要解决的方法:
其他注意事项:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.