Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to add css to text without a tag in a div?

I want to style "Login" text , can I do it without "label" tag ?

here’s my code

<html>

  <head>
    <link rel="stylesheet" href="style.css">
    <link rel="stylesheet" href="WebFontKit/stylesheet.css" type="text/css" charset="utf-8" />
  </head>

<body>
  
    <div class="logindiv">
      <label class="login">Login</label>

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Yes, you can. See the fiddle

div.logindiv::before {
  content:'Login';
  position: top;
  color: red;
}
<html>

  <head>
    <link rel="stylesheet" href="style.css">
    <link rel="stylesheet" href="WebFontKit/stylesheet.css" type="text/css" charset="utf-8" />
  </head>

  <body>
      <div class="logindiv">
      </div>
  </body>
    
</html>
      
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading