html - 如何为包含的 .html 文件动态设置宽度

标签 html css jsp templates

我设计了主页并将其制作成一个单独的 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....

同样我也应用于宽度,有一些小的变化.....

工作真的很好......

关于html - 如何为包含的 .html 文件动态设置宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18913721/

相关文章:

css3 slideup 向下滑动

html - 我的 Adob​​e Illustrator SVG 图像消失了,并且不再显示在 Chrome 上

java - jsp/servlet页面的问题

jsp - 如何设置JSP+Tomcat

javascript - 模块化网页设计

html - 为什么两个没有边距的 div 之间会出现空白?

javascript - 显示/隐藏 div Javascript 错误

javascript - 如何打印 HTML 页面中的特定部分 Angular JS

java - 如何在jsp中访问struts2属性值?

javascript - 动画一个绝对定位的 child 溢出的容器