2019백업

19. Css 가상 클래스 before, after

728x90

ㅁ 나는 제목입니다. 

폼 엘리먼트는 before, after을 가질 수 없다.

input, form, button

 

ex1)

<!DOCTYPE html>
<html lang="ko">
<head>
    <meta charset="UTF-8">
    <title>after before 연습</title>
    <style>
        ul {
            list-style: none;  
        }
        ul li:before {
            content: "*";
            margin-right: 10px;
            color: dodgerblue;
        }
        ul li:after {
            content: "주문불가";
            margin-left: 10px;
            color: white;
            background-color: crimson;
            border-radius: 5px;
            font-size: 12px;
            padding: 1px 5px;       
        }
    </style>
</head>
<body>
    <img src="https://placehold.it/250x150" >
    <ul>
        <li>마요</li>
        <li>카레</li>
        <li>철판볶음밥</li>
        <li>프리미엄 찌개</li>
        <li>덮밥</li>
        <li>비빔밥</li>
    </ul>
</body>
</html>

 

ex2)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>breadcrumb</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
    <style>
        .breadcrumb a {
            text-decoration: none;
            color: black;
        }
        
        .breadcrumb a:hover,.breadcrumb a:focus  {
            text-decoration: none;
            color: red;
        }
    
        .breadcrumb a:after {
            content: '\f105';
            font-family: 'fontawesome';
        }
        .breadcrumb a:last-of-type:after {
            content: '';
        }
        
    </style>
</head>
<body>
    <div class="breadcrumb">
        <a href="#">홈</a>
        <a href="#">전체메뉴</a>
        <a href="#">사각도시락</a>
        <a href="#">모둠시리즈</a>
    </div>
</body>
</html>
반응형