Home  >  Article  >  Backend Development  >  同时对齐且不换行

同时对齐且不换行

WBOY
WBOYOriginal
2016-06-23 13:27:45808browse

各位师哥师姐们,小弟初来乍到,目前一学员。现在我想使abcd四个元素,ab右对齐cd左对齐且不换行,求指教!看分,本人是很诚心的!


回复讨论(解决方案)

<!DOCTYPE html><html><head lang="en">    <meta charset="UTF-8">    <title></title>    <style>        .content{            width: 600px;            height: 30px;            border: 1px solid;            position: relative;        }        .box{            width: 100px;            height: 30px;            border: 1px solid;        }        .ab{            float: left;        }        .cd{            float: right;        }    </style></head><body>    <div class="content">        <div class="box ab">a</div>        <div class="box ab">b</div>        <div class="box cd">c</div>        <div class="box cd">d</div>    </div></body></html>

设置float就可以啦。

其实我昨天后来已经百度,自己也弄出来,但是你是个热情的人,只要回帖正确都给分

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn