• 카테고리

    질문 & 답변
  • 세부 분야

    웹 개발

  • 해결 여부

    미해결

css 적용 문제

22.05.31 00:29 작성 조회수 132

0

<!DOCTYPE html>
<html lang="en">
<head>
    <title>animation information</title>
   
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet"href="main.css">
   
    <style>

        body
        {
            margin:0px;
        }

        header
        {
            position: relative;
            top: 0px;
            width:100%;
            min-width: 1280px;
            height:10vh;
            background-color: hotpink;
        }

        main
        {
            position: relative;
            top: 0px;
            width:100%;
            min-width: 1280px;
            height:90vh;
            background-color: rgb(130, 126, 231);
        }
       
        footer
        {
            position: relative;
            top: 0px;
            width:100%;
            min-width: 1280px;
            height:5vh;
            background-color: hotpink;
        }

        nav    
        {          
            position : relative;
            top: 0px;
            width: 1280px;
            margin:0px auto;
            min-width: 1280px;
            height:100%;
            background-color: rgb(255, 255, 255);
        }    

        button1
        {
            position: relative;
            float: left;
            top: 10px;
            width: 140px;
            cursor: pointer;
        }
        button2
        {
            position: relative;
            top: 10px;
            float: left;
            width: 140px;
            cursor: pointer;
        }
        button3
        {
            position: relative;
            top: 10px;
            float: left;
            width: 140px;
            cursor: pointer;
        }
        button4
        {
            position: relative;
            top: 10px;
            float: left;
            width: 140px;
            cursor: pointer;
        }
        main section1
        {
            position: relative;
            top: 100px;
            width: 600px;
            height: 600px;
            border: 1px solid black;

        }
    </style>
</head>

<body>
   
   <header class = "header">
    <nav class= "nav" >
        <button class="button1">소개</button>
        <button class="button2">추천</button>
        <button class="button3">알림</button>
        <button class="button4">소통</button>
      </div>
    </nav>
   
   </header>
   
   <main class="main">
       <section class="section1">

       </section>
   </main>

   <footer class="footer">

   </footer>
</body>
</html>
 
visual studio code 사용해서 하고있는데, css 적용이 안됩니다 ㅠㅠ

답변 1

답변을 작성해보세요.

0

안녕하세요. 개발자Park입니다.

클래스이름을 가리킬 경우 .을 사용해주셔야 됩니다.

아래처럼 변경해주시면 되겠습니다.

태그일 경우에는 .을 사용안합니다.

감사합니다.

(예시/수정된 코드일부)

 

      .button4

        {

            position: relative;

            top: 10px;

            float: left;

            width: 140px;

            cursor: pointer;

        }

        main .section1
        {

            position: relative;

            top: 100px;

            width: 600px;

            height: 600px;

            border: 1px solid black;



        }
 
김민정님의 프로필

김민정

질문자

2022.05.31

감사합니다 ㅠㅠㅠ