HTML, CSS

'$= 선택자 사용방법'과 파일 다운로드 받을 수 있게 하는 방법

JooKit 주킷 2021. 6. 2. 18:10
목차 접기
728x90
반응형
<!DOCTYPE html>
<html lang="ko">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS기초-14(속성선택자-4)</title>
    <style>
        ul {
            list-style-type: square;
        }


        a {
            line-height: 30px; /* 블럭 형태로 display되어 있는 것을 높이를 조절함 */
            font-size: 14px;
            color: blue;
            text-decoration: none; 
        }

        /* $= 선택자는 지정한 문자로 끝나는 요소에 스타일을 적용시킨다.
        */
        a[href $= "xlsx"] { /* 확장자가 xls로 끝나는 곳에 스타일 적용 */
            background: url(images/excel.png) no-repeat right center;
        }
        a[href $= "hwp"] {
            background-image: url(images/hwp.jpg);
            background-repeat: no-repeat;
            background-position: right;
        }


        a[href] {
            background-size: 30px 20px;
            padding-right: 40px;
        } 


    </style>
</head>
<body>
    <h2>회사소개 파일 다운 받기</h2>
    <ul>
        <li><a href="intro.hwp"  >hwp파일</a></li>
        <li><a href="intro.xlsx" >엑셀파일</a></li>
    </ul>
</body>
</html>

✈ a 태그를 사용하여 파일 다운로드 기능을 만들 수 있다.

$= 선택자

  • 지정한 문자로 끝나는 요소를 찾아서 스타일을 적용시킨다.
728x90
반응형
LIST