搜尋

首頁  >  問答  >  主體

需要協助對齊NETFLIX,選擇標籤,並在一行登入按鈕

<p>我試過顯示:flex;font - family:宋體;我也試過改變寬度,高度,顯示-內聯,內聯-塊,但無法解決。 </p> <pre class="brush:php;toolbar:false;"><!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Clone@Netflix</title> <link rel="stylesheet" href="netflix.css"> </head> <body> <header> <nav class="navigation"> <h2>NETFLIX</h2> <span class="language"> <select name="#" id="lang_inner"> <option value="en">English</option> <option value="hi">Hindi</option> <option value="ar">Arabic</option> <option value="es">Espaniol</option> </select> </span> <button class="signin_button">Sign in</button> </nav> </header> </body> </html></pre> <pre class="brush:php;toolbar:false;">*{ margin:0; padding:0; box-sizing: border-box; font-family: sans-serif; } header{ position:absolute; display:flex; justify-content: space-between; align-items: center; height:100vh; width: 100%; }</pre> <p><br /></p>
P粉769045426P粉769045426484 天前450

全部回覆(1)我來回復

  • P粉879517403

    P粉8795174032023-08-03 12:08:47

    你可以用float: left;:


    *{
        margin:0;
        padding:0;
        box-sizing: border-box;
        font-family: sans-serif;
    }
    header{
        position:absolute;
        display:flex;
        justify-content: space-between;
        align-items: center;
        height:100vh;
        width: 100%;
    }
    
    header .navigation * {
        float: left;
    }
    
    header .navigation > :not(h2) {
        margin-top: 5px;
    }
    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Clone@Netflix</title>
        <link rel="stylesheet" href="netflix.css">
    </head>
    
    <body>
        <header>
            <nav class="navigation">
                <h2>NETFLIX</h2>
                <span class="language">
                    <select name="#" id="lang_inner">
                        <option value="en">English</option>
                        <option value="hi">Hindi</option>
                        <option value="ar">Arabic</option>
                        <option value="es">Espaniol</option>
                    </select>
                </span>
                <button class="signin_button">Sign in</button>
            </nav>
        </header>
    </body>
    
    </html>


    #

    回覆
    0
  • 取消回覆