元素宽度:100%不使用容器/容器流体

时间:2014-10-20 07:27:53

标签: html css html5 twitter-bootstrap twitter-bootstrap-3

我试图制作一个全宽的图像标题,但图像始终采用容器宽度而不是100%宽度(即使我把div放在容器外面)。我已经尝试了几乎所有的东西,没有任何效果,这个答案here没有帮助。如果我在自定义css中更改.container宽度,可能会这样做,但这会破坏整个网站设计。

代码:

<body style="background-color: #eee">

    <div class='container-fluid'>

        <div class="row" style='width: 100%'> 
            <div class='' style='height: 10px; margin: 0 0;padding: 0 0 ; width:100%'>        
                <img class=''  src="images/shape1.png" style='height: 100%; width:100%; margin-bottom: 13px'>               
            </div>
        </div>


    <div class='row text-center rowStyle' >

        <img id='leftLogo'  src="images/kslogo.png">
        <img id='rightLogo' src="images/kglogo.png">

        <div class='searchContainer'>
         <table class='table-responsive searchTable'>
                <tr>
                    <td width='15%'>
                        <img class='searchButton'  src="images/btn-search.png" >
                    </td>
                    <td width='85%'>
                        <input type='text' class="form-control searchInput">
                    </td>
                </tr>
            </table>                                    

        </div>     

        <div class="row " style="margin-top: 40px; margin-left: auto !important;margin-right: auto !important ; width: 76%" >
            <div class="text-center col-md-4 items" >
                <img src='images/btnlog-in.png' class='buttonsLocation'>
                <img class="" src="images/Aricles03.png" alt="Generic placeholder image">        
            </div><!-- /.col-lg-4 -->
            <div class="text-center col-md-4 items" >
                <img src='images/btnlog-in.png' class='buttonsLocation'>
                <img class="" src="images/Aricles01.png" alt="Generic placeholder image">
            </div><!-- /.col-lg-4 -->
            <div class=" text-center col-md-4 items" style=' position: relative ;'>
                <img src='images/btnlog-in.png' class='buttonsLocation'>
                <img class="" src="images/Aricles02.png" style=''>

            </div><!-- /.col-lg-4 -->
        </div><!-- /.row -->


        </div>
    </div>


    <div style='height: 80px; margin-top: 84px;padding: 0 0 ; width:100%; background-color:  #e3e3e3;'>

    </div>

</body>

编辑:添加完整代码+屏幕截图

enter image description here

我正在使用bootstrap3

任何帮助将不胜感激, 谢谢

3 个答案:

答案 0 :(得分:0)

可能是,你忘了关闭&#34; <div class='container-fluid'>&#34;标记

答案 1 :(得分:0)

类.container-fluid的左右填充设置为15px。所以,如果你不需要,只需覆盖它。

答案 2 :(得分:0)

尝试:

    <div class="container-fluid">

        <div class="row"> 
            <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="height: 10px; padding-left: 0; padding-right: 0;">        
                <img src="images/shape1.png" style="height: 100%; width:100%; margin-bottom: 13px">               
            </div>
        </div>

相关问题