相关疑难解决方法(0)

在CSS中居中一个div

我正在尝试将newsslider(在div底部容器中)放在此页面上:

http://www.luukratief-design.nl/dump/parallax/index.html

我已经有了 text-align: center;

它仍然无效.

有什么建议?

html css center

28
推荐指数
3
解决办法
2万
查看次数

垂直对齐div(无表格)

我可以水平对齐div,所有内容看起来都很棒.寻找垂直对齐不包含任何表格的div.我尝试将保证金头寸设置为#container内部的一些负值,但这种方式有效.我知道CSS还不支持这个吗?

这是我的标记:

body
{
    background: #777; /* gray */
    text-align: center;
}

#container 
{ 
    margin: 0 auto;
    width: 968px;
    text-align: left;
}

#toptab
{
    background: #f77; /* red */
    height: 14px;
    width: 968px;
}

#middletab
{
    background: #7f7; /* green */
    width: 968px;
}

#data
{
    width: 948px; /* 948 for the box plus we need 20 more px to handle the padding */
    padding-left: 10px; 
    padding-right 10px;
}

#bottomtab
{
    background: #77f; /* blue */
    height: 14px;
    width: 968px; …
Run Code Online (Sandbox Code Playgroud)

html css alignment

20
推荐指数
2
解决办法
2万
查看次数

在bootstrap页面上居中表

我试图使用bootstrap中心表.

这是html:

<div class="container-fluid">
    <table id="total votes" class="table table-hover text-centered">
        <thead>
            <tr>
                <th>Total votes</th>
                <th> = </th>
                <th>Voter A</th>
                <th> + </th>
                <th>Voter B</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>{{ total_votes }}</td>
                <td> = </td>
                <td>{{ total_voter_a }}</td>
                <td> + </td>
                <td>{{ total_voter_b }}</td>
            </tr>
        </tbody>    
    </table>
</div>
Run Code Online (Sandbox Code Playgroud)

但是,无论我如何调整css,桌子仍然与左边对齐.我确定我错过了一些简单的事情.我还以为container-fluid会让这个表跨越整个页面.

这是css:

.table th {
    text-align: center;
}

.table {
    border-radius: 5px;
    width: 50%;
    float: none;
}
Run Code Online (Sandbox Code Playgroud)

html css twitter-bootstrap

12
推荐指数
2
解决办法
6万
查看次数

标签 统计

css ×3

html ×3

alignment ×1

center ×1

twitter-bootstrap ×1