Reputation: 51
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
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
Reputation: 11
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
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
Reputation: 1
You can make content italic using font-style and bold using font-weight
div {
font-weight: bold;
font-style: italic;
}
Upvotes: 0