簡體   English   中英

我的第二個div中我未排序的列表未顯示在哪里?

[英]my second div where I put my unordered list not displaying ?

我正在嘗試創建一個待辦事項列表應用程序,當我要創建要創建無序列表的第二個div時,它沒有顯示,而且我似乎也不知道為什么它沒有顯示。 我試過擦除該div並創建一個enw並編寫一個簡單的hello消息,但沒有顯示。 我猜它與不允許它的第一個div有關。

<!doctype html>
<html>
<head>
      <title>To Do list</title>

    <style type="text/css">

        #topBar-div{
            background-color: #F44336;
            position:absolute;
            top: 0px;
            width:100%;
            height: 150px;

        }

        body{
            margin: 0px;
            padding: 0px;
        }

        h1{
            color:white;
            margin-left: 300px;
        }

        #textInput{
            height: 30px;
            margin-left: 100px;
            width: 600px;
            font-size: 20px;
            color: #8E8E8E;
        }

        #addButton{
            height:37px;
            position:relative;
            top:-4px;
            right: 5px;
            width: 70px;
            color: grey;

        }

        #secondBar-div{
            color: grey;
            height: 350px;
            width: 1000px;
        }


    </style> 

</head>

<body>
    <div id="topBar-div">

        <h1>My To Do List</h1>

        <input type="text" value="Title..." id="textInput">

        <button id="addButton">Add</button>

    </div>

    <div id="secondBar-div">

        <ul>

            <li>Hit the gym</li>
            <li>Pay bills</li>
            <li>Meet George</li>
            <li>Buy eggs</li>
            <li>Study</li>
            <li>Cook Dinner</li>

        </ul>


    </div>


    <script type="text/javascript">


    </script>

</body>
</html>

您以第一個div(topBar-div)的樣式使用絕對位置,因此您的第二個div(secondBar-div)向上移動,並且實際上位於該第一個div的后面。

嘗試將其添加到#secondBar-div

margin-top: 150px;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM