How to Use Before And After Classes For Website Design
Posted By : Vikas Pundir | 30-Oct-2018
Use
:
<div> <!- - text inside the div - > cards </div> div::after { content: "cards"; }
Use of ::before-
:
You need the created substance to precede the component content, positionally.
The incentive for the substance can be:
A string: content: "a string"; - uncommon characters should be exceptionally encoded as a Unicode element. See the glyphs page.
A picture: content:
Not much:
A counter: content: counter(li); - Really helpful for styling records until :marker tags along.
Note that you can't embed HTML (in any event, that will be rendered as HTML). content: "<h1>nope</h1>";
#: vs ::
Each program that backings the twofold colon (::) CSS3 sentence structure likewise underpins only the (:) grammar, however, IE 8 just backings the single-colon, so for the time being, it's prescribed to simply utilize the single-colon for best program bolster.
:: is the fresher configuration indented to recognize pseudo substance from pseudo selectors. On the off chance that you needn't bother with IE 8 bolster, don't hesitate to utilize the twofold colon.
The most essential advantage of
Breadcrumbs (route) using :before and :after
Generally, when you do breadcrumbs you have connections and separator between them. Rather than including a component into the DOM, you could accomplish a similar impact with unadulterated
HTML: <p> <a href="#">Home</a> <a href="#">About</a> <a href="#">Team</a> </p> Just a few lines of CSS: a { text-decoration: none; font-weight: bold; color: #000; } a:after { content: " /"; } a:first-child:before { content: " » "; } a:last-child:after { content: ""; }
Icons
It is exceptionally well known to
HTML: <p>paragraph text</p> and CSS: p:before { content: ""; display: block; background: url("img.jpg") no-repeat; width: 20px; height: 20px; float: left; margin: 0 6px 0 0; }
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Vikas Pundir
Vikas has a good knowledge of HTML, CSS and JavaScript. He is working as a UI Developer and he love dancing and painting.