Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.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
Html 如何将两个具有不同内容的div居中对齐?_Html_Css_Twitter Bootstrap - Fatal编程技术网

Html 如何将两个具有不同内容的div居中对齐?

Html 如何将两个具有不同内容的div居中对齐?,html,css,twitter-bootstrap,Html,Css,Twitter Bootstrap,我有两个内容不同的divs - 我们希望你带走的三大创意 这是更新代码,对我来说效果很好,希望它能解决您的问题 <div class="container-fluid" style="background-color:#2c5fd9;"> <div class="row" style="padding:10px 0; display:table; width:auto; margin:0px auto"> <div cla

我有两个内容不同的
div
s


-
我们希望你带走的三大创意

这是更新代码,对我来说效果很好,希望它能解决您的问题

<div class="container-fluid" style="background-color:#2c5fd9;">
        <div class="row" style="padding:10px 0; display:table; width:auto; margin:0px auto">
            <div class="col-lg-1" style="display:table-cell;vertical-align:middle;border-right:1px solid #fff;">
                <div style="width:100%;color:#fff;">-</div>
            </div>

            <div class="col-lg-10" style="display:table-cell;vertical-align:middle;padding:0 10px;">
                <h1 style="width:85%">The three big ideas we hope you take away</h1>
            </div>
        </div>
    </div>

-
我们希望你带走的三大创意

这应该是您的解决方案:

HTML

<div class="container-fluid custom-box">
    <div class="row">
        <div class="col-lg-1 line">
            <div class="hr"></div>
        </div>
        <div class="col-lg-10 content">
            <h1>The three big ideas we hope you take away</h1>
        </div>
    </div>
</div>

这里有一个小提琴可以尝试:

请发布您的相关CSS代码,以及足够的HTML。你也在使用推特引导吗?是的,我在使用推特引导。所有的css都是内联的。没有应用额外的css。我想要与imageno中给出的效果相同的效果。没用了,跟以前一样。向行中添加样式在allIt无法工作,除非使用twitter引导。但是一旦我放置bootstrap.min.css,它就会改变布局,明白了。有一个关于浮动的问题:左;适用于lg级。
.custom-box {
    background-color:#00577b;
    padding:30px 0;
    width:700px;
}
.custom-box .line {
    border-right:1px solid #fff;
    display:table-cell;
    padding:0;
    vertical-align:middle;
}
.custom-box .content {
    display:table-cell;
    padding:10px 40px;
    vertical-align:middle;
}
.custom-box .content h1 {
    color:#fff;
    padding:0;
    margin:0;
}
.hr {
    border-top:1px solid #fff;
    height:1px;
    width:75px;
}