Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/370.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 当我将宽度设为100%时,元素没有中心对齐_Javascript_Html_Css_Twitter Bootstrap - Fatal编程技术网

Javascript 当我将宽度设为100%时,元素没有中心对齐

Javascript 当我将宽度设为100%时,元素没有中心对齐,javascript,html,css,twitter-bootstrap,Javascript,Html,Css,Twitter Bootstrap,我正在使用twitter引导。。。 问题是容器宽度不是100%。。。。 如何使其成为100%。。。。 这样所有的东西都会中心对齐 在firbug中,我将容器宽度更改为100%,但其未居中对齐。。。 如何修复它 .container、.navbar固定顶部.container、.navbar固定底部.container{ 宽度:940px; } 采购订单 遵循下面的示例代码 body { min-width: 550px; /* 2 x LC width

我正在使用twitter引导。。。 问题是容器宽度不是100%。。。。 如何使其成为100%。。。。 这样所有的东西都会中心对齐 在firbug中,我将容器宽度更改为100%,但其未居中对齐。。。 如何修复它


.container、.navbar固定顶部.container、.navbar固定底部.container{
宽度:940px;
}
采购订单

遵循下面的示例代码

    body {
        min-width: 550px;         /* 2 x LC width + RC width */
    }

    #container {
        padding-left: 200px;      /* LC width */
        padding-right: 150px;     /* RC width */
    }

    #container .column {
        position: relative;
        float: left;
    }

    #center {
        width: 100%;
    }

    #left {
        width: 200px;             /* LC width */
        right: 200px;             /* LC width */
        margin-left: -100%;
    }

    #right {
        width: 150px;             /* RC width */
        margin-right: -100%;
    }

    #footer {
        clear: both;
    }

    /*** IE6 Fix ***/
    * html #left {
        left: 150px;              /* RC width */
    }

    /*** Just for Looks ***/

    body {
        margin: 0;
        padding: 0;
        background: #FFF;
    }

    #header, #footer {
        font-size: large;
        text-align: center;
        padding: 0.3em 0;
        background: #999;
    }

    #left {
        background: #66F;
    }

    #center {
        background: #DDD;
    }

    #right {
        background: #F66;
    }

    #container .column {
        padding-top: 1em;
        text-align: justify;
    }



  <div id="container">

    <div id="center" class="column">
        <h1>This is the main content.</h1>
        <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
        <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
    </div>

    <div id="left" class="column">
        <h2>This is the left sidebar.</h2>
        <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. </p>
    </div>

    <div id="right" class="column">
        <h2>This is the right sidebar.</h2>
        <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. </p>
    </div>

</div>
正文{
最小宽度:550px;/*2 x LC宽度+RC宽度*/
}
#容器{
左侧填充:200px;/*LC宽度*/
右侧填充:150px;/*RC宽度*/
}
#容器.列{
位置:相对位置;
浮动:左;
}
#居中{
宽度:100%;
}
#左{
宽度:200px;/*LC宽度*/
右:200px;/*LC宽度*/
左边距:-100%;
}
#对{
宽度:150px;/*钢筋混凝土宽度*/
保证金权利:-100%;
}
#页脚{
明确:两者皆有;
}
/***IE6修复***/
*html#左{
左:150px;/*钢筋混凝土宽度*/
}
/***只是为了好看***/
身体{
保证金:0;
填充:0;
背景:#FFF;
}
#页眉,#页脚{
字体大小:大号;
文本对齐:居中;
填充:0.3em0;
背景:#999;
}
#左{
背景:#66F;
}
#居中{
背景:DDD;
}
#对{
背景:#F66;
}
#容器.列{
垫面:1米;
文本对齐:对齐;
}
这是主要内容。
这是一位杰出的领袖,他是一位伟大的领袖

这是一位杰出的领袖,他是一位伟大的领袖

这是左侧边栏。 这是一位杰出的领袖,他是一位伟大的领袖

这是右边的边栏。 这是一位杰出的领袖,他是一位伟大的领袖


你能解释一下“问题是容器宽度不是100%……如何使其成为100%……”@XTG:谢谢你的回答……我正试图实现类似的目标……通过使我的文本字段占据整个监视器。。。你是说网页有100%的宽度吗?@XTG:是的,怎么做。container,.navbar固定顶部。container,.navbar固定底部。container{width:940px;}我发布了
    body {
        min-width: 550px;         /* 2 x LC width + RC width */
    }

    #container {
        padding-left: 200px;      /* LC width */
        padding-right: 150px;     /* RC width */
    }

    #container .column {
        position: relative;
        float: left;
    }

    #center {
        width: 100%;
    }

    #left {
        width: 200px;             /* LC width */
        right: 200px;             /* LC width */
        margin-left: -100%;
    }

    #right {
        width: 150px;             /* RC width */
        margin-right: -100%;
    }

    #footer {
        clear: both;
    }

    /*** IE6 Fix ***/
    * html #left {
        left: 150px;              /* RC width */
    }

    /*** Just for Looks ***/

    body {
        margin: 0;
        padding: 0;
        background: #FFF;
    }

    #header, #footer {
        font-size: large;
        text-align: center;
        padding: 0.3em 0;
        background: #999;
    }

    #left {
        background: #66F;
    }

    #center {
        background: #DDD;
    }

    #right {
        background: #F66;
    }

    #container .column {
        padding-top: 1em;
        text-align: justify;
    }



  <div id="container">

    <div id="center" class="column">
        <h1>This is the main content.</h1>
        <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
        <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
    </div>

    <div id="left" class="column">
        <h2>This is the left sidebar.</h2>
        <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. </p>
    </div>

    <div id="right" class="column">
        <h2>This is the right sidebar.</h2>
        <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. </p>
    </div>

</div>