not4n4
not4n4

Reputation: 51

How do I make CSS Content italic and bold?

Okay so, I wanna make the CSS content class italic and bold. Here's my code.

div::before {
     content: "text";
     color:black;
}
<div></div>

I wanna do it ONLY using CSS, no HTML. The reason for this is because I am making a Discord Theme which is only possible with CSS, no custom HTML.

Upvotes: 0

Views: 3474

Answers (4)

Mahantesh Kallur
Mahantesh Kallur

Reputation: 1

<!DOCTYPE html>
<html>
<head>
<title>Css Content Italic And Bold</title>
<style>
div::before {
     content: "text";
     color:black;
     font-weight: bold;
     font-style: italic;
}
</style>
</head>
<body>

<div></div>

</body>
</html>

Upvotes: 0

Humayun Kamal
Humayun Kamal

Reputation: 11

  1. First Add some text in div because this will allow you get difference then apply property of font-style: (normal or italic).

    language: html

Before >

After > Italic Text

 language: css

div::before {
     content: "text";
     color:black;
     font-style : italic;
}

Upvotes: 0

TechySharnav
TechySharnav

Reputation: 5094

You can add font-weight and font-style properties to ::before itself.

div::before {
     content: "text";
     color:black;
     font-weight: bold;
     font-style: italic;
}
<div></div>

Upvotes: 1

Abdul Wasay
Abdul Wasay

Reputation: 1

You can make content italic using font-style and bold using font-weight

div {
  font-weight: bold;
  font-style: italic;
}

Upvotes: 0

Related Questions