.parent-div {
position: relative;
width: 100px;
height: 100px;
background: #ffffff;
border: 1px solid #000000;
}
.div:before {
content: "";
width: 20px;
height: 20px;
background: blue;
position: absolute;
top: 45%;
left: 45%;
}
/*
"before" & "after" are pseudo-contents.
They end up *into* the tag they are declared for.
They are just right "before" or "after" the *content* of tag they're in.
Declare their "content" CSS rule to make them visible.
*/
div::before /* <div>|here|Content of tag</div> */
{
content: "|here|";
}
div::after /* <div>Content of tag|here|</div> */
{
content: "|here|";
}
/*
Double-colon should be used: it's the meant pseudo-content operator.
IE8 doesn't support it though: it supports single-colon (meant for pseudo-selectors).
So IE8 support needs the following:
div:before { ... }
div:after { ... }
*/
div::before {
content: "before";
}
div::after {
content: "after";
}
<style>
div::before {
content: "before";
}
div::after {
content: "after";
}
</style>
<div>
before
<!-- Rest of stuff inside the div -->
after
</div>
Code Example |
---|
Css :: selector css |
Css :: css clip path text |
Css :: react use global css |
Css :: sass syntax cheat sheet |
Css :: add pseudo buttons |
Css :: scroll css |
Css :: bulma lowercase |
Css :: w3.css templates |
Css :: css inherit class |
Css :: css how to make 2d animations at once |
Css :: how to make jest parse the imported css modules in create react app |
Css :: arriviste |
Css :: react exact path highlight |
Css :: easyui datagrid header wrap |
Css :: Hoow to open a css class in css |
Css :: null z transform hack |
Css :: css animation click |
Css :: .cameleons |
Css :: moving nested element up css |
Css :: insert millions of records mongodb |
Css :: how to debug datatables |
Css :: font face roboto css |
Css :: Creating Hashnode logo with CSS |
Css :: change d in path svg css |
Css :: padding 2 values how would be they applied |
Css :: css widows |
Css :: order |
Css :: edit default theme in component angular css |
Css :: disable safari form formatting |
Css :: Structs in Golang |