Please Allow Notifications

If you want to get our blog posts notification, you can subscribe our website by clicking on allow notification button



FOLLOW US ON TWITTER



FOLLOW US



img/blogimg/css3.jpg


@coder 755

PSEUDO ELEMENTS


2021-11-16 23:17 · 4 min read

The CSS3 Pseudo-elements are used to change the style of the specific part of an HTML Element i.e if we want to change the first line of an HTML element this can be done easily by pseudo-elements.

 

How to use Pseudo Elements?

Here is a simple example of a pseudo-element.

  • ::first-letter Pseudo-element
    This pseudo-element is used to add a special style to the first letter of the text.
  • example
    Here we can use multiple CSS properties to change the style of the first letter of HTML elements.
<style>
/*Pseudo Element Example*/
element-selector::pseudo-element {
property: value;
}
</style>
<head>
<style>
div::first-letter {
color: red;
font-size: 50px;
}
</style>
</head>
<body>
<div>TDB-School</div>
</body>

 

::first-line Pseudo-element

Here is a simple example of a pseudo-element.

  • ::first-letter Pseudo-element
    This pseudo-element is used to add a special style to the first letter of the text.
  • example
    Here we can use multiple CSS properties to change the style of the first letter of an HTML elements.
<style>
/*Pseudo Element Example*/
div::first-line {
color: red;
font-size: 50px;
}
</style>

Note: We can apply ::first-line pseudo-element only on HTML block-level elements.

 

<head>
<style>
div::first-line {
color: red;
font-size: 50px;
}
</style>
</head>
<body>
<div>TDB-School<br> TDB-Tutorial</div>
</body>

 

Other pseudo-elements

We can also use multiple pseudo-elements on a single block-level HTML Tag.

  • Multiple pseudo elements
<style>
div::first-letter {
color: red;}
div::first-line {
color: red;}
</style>
  • ::before Pseudo-element
<style>
/*Pseudo Element Example*/
div::before {
content:"your text";
}
</style>
<head>
<style>
div::before {
content:"your text"
}
div::first-letter {
color: red;}
</style>
</head>
<body>
<div>TDB-School<br> TDB-Tutorial</div>
</body>

 

TAGS:






POST COMMENTS
No Comment

Please login to post comment




POPULAR POSTS

what is new in miui 11?...
best free web hosting services...
free website ssl security using cloudfla...
do you want to make money online?...
CSS3 @IMPORT RULES...
CSS3 RESPONSIVE UI...
Tables HTML...
How to host a web page in 10 minutes....
How to use CSS3 Overflow Property?...
CSS3 FUNCTIONS...
CSS3 FILTERS...
CSS3 SHAPES...


RECENT COMMENTS

2022-03-05 11:05
By coder on XAMPP - MySQL shutdown unexpectedly | How to fix MySQL crash unexpectedly
2021-10-12 12:34
By abnongoke on do you want to make money online?
2021-10-12 12:34
By abnongoke on how to get a free website domain name?
2021-10-12 12:34
By solar panel for shed on what is new in miui 11?
2021-10-12 12:34
By solar panel for shed on best free web hosting services
2021-10-12 12:34
By amos tanui on free website ssl security using cloudflare


SOCIAL SHARE



FOLLOW US ON TWITTER



FOLLOW US ON FACEBOOK



FOLLOW US







Recent Blogs



Contact Us

Subscribe Our News-Letter



Kashipur, 244713
Uttarakhand, India



© blog.theprodevelopers.com 2022. All Rights Reserved. Powered by Pro Developer