How is this put in the center using CSS?

感情迁移 提交于 2019-12-02 07:42:43

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

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

Now -

<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>

horizontal-align does not exist. Use text-align: center instead. To horizontally center the element itself, use margin: 0 auto;, which equals:

margin-top: 0;
margin-right: auto;
margin-bottom: 0;
margin:left: auto;

The automatic right and left margin results in a centered element.

If you want to vertically align an element, use vertical-align: center (this does only work on inline elements).

Wrap them in a <div style="text-align: center;"> (or use some other way to apply that style to a containing element).

Wrap them in a div

#center {
margin: 0 auto 0 auto; }

Then apply

<div id="center"> <YOURSTUFF HERE> </div>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!