Css:- First line

    The first-line selector is used to add a style to the first line of the specified selector.
    The first-line selector can only be used with block-level elements.

Code:-

<!DOCTYPE html> 
<html> 
 
<head> 
 <meta name="viewport" content="width=device-width, initial-scale=1"> 
 
 <style> 
  div::first-line { 
   background-color: green; 
  } 
 </style> 
 
</head> 
 
<body> 
 <div> 
  This is the first div and if you have many lines here then it the "first-line" class only applied for the first line. Other lines are display normally. 
  <br/> This is the second line. 
 </div> 
 
</body> 
 
</html>


Output:-

This is the first div and if you have many lines here then it the "first-line" class only applied for the first line. Other lines are display normally. 
This is the second line.


Css:- First line Css:-  First line Reviewed by Network security on May 12, 2019 Rating: 5

No comments:

Useful Information

Powered by Blogger.