Search
 
SCRIPT & CODE EXAMPLE
 

CSS

Before and After Pseudo Selectors

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Before and after pseudo selector</title>
    <link href="https://fonts.googleapis.com/css?family=Bree+Serif&display=swap" rel="stylesheet">
    <style>
        body {
            margin: 0;
            padding: 0;
            background-color: black;
            color: white;
        }

        header::before{
            background: url('https://source.unsplash.com/collection/190727/1600x900') no-repeat center center/cover;
            content: "";
            position: absolute;
            top:0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
            opacity: 0.3;
        }

        .navigation {
            font-family: 'Bree Serif', serif;
            font-size: 20px;
            display: flex;
        }

        li {
            list-style: none;
            padding: 20px 23px;
        }

        section {
            height: 344px;
            font-family: 'Bree Serif', serif;
            margin: 3px 230px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        h1 {
            font-size: 4rem;
        }

        p {
            text-align: center;
        }

        /* section::after{
        content:"this is a content"
    } */

    </style>
</head>

<body>
    <header>
        <nav class="navbar">
            <ul class="navigation">
                <li class="item">Home</li>
                <li class="item">About</li>
                <li class="item">Services</li>
                <li class="item">Contact Us</li>
            </ul>
        </nav>
    </header>
        <section>
            <h1> Welcome to Coding World</h1>
            <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Provident error ratione doloribus sed dolorum,
                ipsum cumque reprehenderit dignissimos architecto veniam optio sint aliquam consectetur corrupti vero
                similique velit. Possimus eum consequatur delectus quia magni.</p>
        </section>
       
</body>

</html>
Comment

how to use after pseudo class in css

a::after {
  content: "whatever content you want to display";
  /*css declaration*/
}
Comment

how to use before pseudo class in css

a::before {
  content: "whatever content you want to display";
  /*css declaration*/
}
Comment

PREVIOUS NEXT
Code Example
Css :: django jsonfield 
Css :: css change image height 
Css :: css keep aspect ratio image 
Css :: woolentor product archive not centered 
Css :: form css design 
Css :: Scrollbar inside a website 
Css :: format hexagonal css get 
Css :: css ovel 
Css :: css multiple classes same rule 
Css :: stop mysqld.exe cmd 
Css :: rendre une div scrollable 
Css :: selectors in css 
Css :: Every user on your website has an image avatar that is displayed when 
Css :: tailwind simple product card 
Css :: css @apply 
Css :: blue gradient 
Css :: css 100vh minus header 
Css :: Build a Responsive Real World Website From Scratch HTML CSS 
Css :: wrapping links in css 
Css :: css !important 
Css :: css animation not working 
Css :: css font weight 
Css :: advanced selectors in css 
Css :: backface-visibility: hidden; 
Css :: css nested class 
Css :: table td css 
Css :: how to give css only to a paticular image 
Css :: modificar la clase segun id que está dentro de un span css 
Css :: opacity gradual css 
Css :: if i forked and cloned a github repo can i change the name 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =