html讓兩個div並排顯示的方法


下面寫個demo,僅供參考。

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
        #page
        {
            margin:0 25% 0 25%;
            padding: 10px 10px;
            border:3px solid green;
            height:500px;
        }
        #header
        {
            margin: 0 auto;
            height: 100px;
            border:3px dashed pink;
            text-align:center;
        }
        #search
        {
            margin: 10px 0;
            border:3px solid deeppink;
            height :50%;
            width:45%;
            float:left;
            font-size: 28px;
        }
        #search2
        {
            margin: 10px 0;
            border:3px solid deeppink;
            height :50%;
            width:45%;
            float:right;
            font-size: 28px;
        }
    </style>
</head>
<body>
<div id=page>
    <div id=header>
        <h1>頭部</h1>
    </div>
    <div id=search>
        <p></p>
    </div>
    <div id=search2>
        <p></p>
    </div>
</div>
</body>
</html>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM