Home > OS >  how to add css to text without a tag in a div?
how to add css to text without a tag in a div?

Time:10-19

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 >
      <label >Login</label>

CodePudding user response:

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 >
      </div>
  </body>
    
</html>
      

  • Related