Javascript

구글 UI 클론 코딩-2

big whale 2021. 5. 26. 21:15

로고, 검색창, 하단부 마무리

창을 줄일 때 어느 너비까지만 검색창이 줄어들게 하고 싶었는데 min-width를 몰라서 한참 헤맸다.

클론 코딩을 진행하면서 float 기능 숙달과 요소간 배치 조절에 대해 배웠다.

<html>
    <head>
    <style>
        body {
            margin: 0;
        }
        /* 스크롤바 없애기*/
        body{-ms-overflow-style:none; }
        body::-webkit-scrollbar { display:none; }

        .menus {
            margin: 10px;
            text-align: center;
        }

        .login {
            width: 100px;
            height: 40px;
            background-color: #1973E8;
            border-radius: 3px;
            text-align: center;
            line-height: 40px;
            color: white;
            font-size: 14px;
            font-weight: bold;
        }

        .text {
            font-size: 15px;
            color: black;
            text-align: center;
            line-height: 40px;
        }

        .float-right {
            float: right;
        }

        .margin-right {
            margin-right: 10px;
        }

        .menuicon {
            line-height: 45px;
            margin-right: 20px;
            margin-left: 10px;
            margin-top: 11px;
        }

        .center {
            width: 50%;
            margin: auto;
            position: relative;
            top: 200px;
        }

        #searchbox {
            display: block;
            margin-left: auto;
            margin-right: auto;
            width: 80%;
            height: 45px;
            border: 1px solid rgba(94, 94, 94, 0.2);
            border-radius: 22px;
            min-width: 350px;
        }

        #magnifier {
            opacity: 0.8;
            width: 20px;
            height: 20px;
            margin-left: 15px;
            padding-top: 15px;
            float: left;
        }

        #search {
            border: 0px;
            display: block;
            margin-left: auto;
            margin-right: auto;
            width: 40%;
            height: 45px;
            border-radius: 22px;
            float: left;
        }
        #search:focus {
            outline-width: 0;
        }

        #keyboard {
            width: 30px;
            height: 30px;
            margin-top: auto;
            margin-bottom: auto;
            margin-right: 20px;
            padding-top: 10px;
            float: right;
        }

        #mic {
            margin-top: auto;
            margin-bottom: auto;
            width: 15px;
            height: 20px;
            padding-top: 15px;
            margin-right: 25px;
            float: right;
        }

        .logo {
            display: block;
            margin-left: auto;
            margin-right: auto;
        }

        #btn1 {
            background-color: #F8F9FA;
            border: 1px solid #F8F9FA;
            border-radius: 5px;
            position: relative;
            left: 40px;
            padding: 8px 13px;
        }
        #btn1:focus {
            outline-width: 0;
        }

        #btn2 {
            background-color: #F8F9FA;
            border-radius: 5px;
            border: 1px solid #F8F9FA;
            position: relative;
            left: 50px;
            padding: 9px 13px;
        }

        #btn2:focus {
            outline-width: 0;
        }

        #btncenter {
            width: 300px;
            margin-left: auto;
            margin-right: auto;
        }

        footer {
            position: absolute;
            bottom: 0;
            width: 100%;
            height: 97px;
            background-color: #F2F2F2;
            border: none;
        }

        #footer1 {
            height: 48.5px;
            font-size: 15px;
            opacity: 0.5;
        }

        hr {
            margin: 0;
            opacity: 0.3;
        }

        #footer2 {
            height: 48.5px;
            font-size: 15px;
            opacity: 0.5;
        }

        .footerbtn {
            float: left;
            padding-left: 30px;
            line-height: 48px;
        }

        a {
            text-decoration: none;
        }
        
        a:visited {
            color: black;
        }

        a:hover {
            text-decoration: underline;
        }

        .footerbtn2 {
            float: right;
            padding-right: 30px;
            line-height: 48px;
        }
    </style>
</head>
<body>
    <div>
        <div class="menus">
            <a class="login float-right">로그인</a>
            <a href="" class="float-right margin-right menuicon"><img src="../menuicon.png" width="15px" height="15px"></a>
            <a href="" class="text float-right margin-right">이미지</a>
            <a href="" class="text float-right margin-right">Gmail</a>
        </div>
        <div class="center">
            <a href="https://www.google.com"><img class="logo" src="../logo.png"></a>
            <div id="searchbox">
                <img id="magnifier" src="../magni.png">
                <input id="search" type="search">
                <a href=""><img id="mic" src="../mic.png"></a>
                <a href=""><img id="keyboard" src="../keyboard.png"></a>
            </div>
            <br>
            <div id="btncenter">
                <input id="btn1" type="button" value="Google검색">
                <input id="btn2" type="button" value="I'm Feeling Lucky">
            </div>
        </div>
        <footer>
            <div id="footer1">
                <a href="" class="footerbtn">대한민국</a>
            </div>
            <hr>
            <div id="footer2">
                <a href="" class="footerbtn">Google정보</a>
                <a href="" class="footerbtn">광고</a>
                <a href="" class="footerbtn">비즈니스</a>
                <a href="" class="footerbtn">검색의 원리</a>
                <a href="" class="footerbtn2">설정</a>
                <a href="" class="footerbtn2">약관</a>
                <a href="" class="footerbtn2">개인정보처리방침</a>
            </div>
        </footer>
    </div>
</body>
</html>

출력 결과