这是怎么放在中心使用CSS? [英] How is this put in the center using CSS?

查看:149
本文介绍了这是怎么放在中心使用CSS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,我想把div标签下面的页面的中心。在CSS中如何做到这一点?

Basically I want to put the div tags below in the center of the page. How is this done in CSS? I am having such a hard time doing it what is the best option!?

HTML

<div class="tab-selected" id="search">Search</div>
<div class="tab-unselected" id="search">Tags</div>
<div class="tab-unselected" id="search">Recruiters</div>

CSS:

.tab-selected {
background: #FF00FF;
-moz-border-radius: 3px;
border-radius: 3px;
font: 13px helvetica;
color: #FFFFFF;
height: 15px;
display: inline;
}

.tab-unselected {
-moz-border-radius: 3px;
border-radius: 3px;
font: 13px helvetica;
color: #585858;
height: 15px;
display: inline;
margin: 5px 5px 5px 5px;
padding: 5px 5px 5px 5px;
position: relative;
width: 60px;
display: inline-block;
horizontal-align: center;
}


推荐答案

$ c> .tab-unselected 在一个单独的 div 中,其属性将是 -

Wrap the class .tab-unselected in a seperate div whose properties would be -

.center { margin: 0 auto; float: none; }

现在 -

<div class="center">
    <div class="tab-selected" id="search">Search</div>
    <div class="tab-unselected" id="search">Tags</div>
    <div class="tab-unselected" id="search">Recruiters</div>
</div>

这篇关于这是怎么放在中心使用CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆