본문 바로가기

HTML&CSS

CSS를 <li>에 적용해 메뉴 만들기 // To create menu

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #mbar{
            background: olive;      
        }
        #mbar ul{
            margin: 0;
            padding: 0;
            width: 567px; 
        }
        #mbar ul li{
            display: inline-block; /*3줄로 넘어가지 않게*/
            list-style-type: none; /*목록 앞 마커정하기 : 없음*/
            padding: 0px 15px;
        }
        #mbar ul li a{
            color: white;
            text-decoration: none;
        }
        #mbar ul li a:hover{ /*내용에 마우스 올럈을 때 */
            color: violet;
        }
 
    </style>
</head>
<body>
    <nav id="mbar">
        <ul>
            <li><a href="#">Home</a></li>
            <li><a href="#">Espresso</a></li>
            <li><a href="#">Cappusssino</a></li>
            <li><a href="#">Cafe Latte</a></li>
            <li><a href="#">F.A.Q</a></li>
        </ul>
    </nav>
</body>
</html>
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs