好吧,我想让 CSS 内容类斜体和粗体。这是我的代码。
div::before {
content: "text";
color:black;
}
<div></div>
我想做ONLY使用 CSS,没有 HTML。这是因为我正在制作一个 Discord 主题,只有 CSS 才有可能,没有自定义 HTML。

您可以将font-weight
和font-style
属性添加到::before
本身。
div::before {
content: "text";
color:black;
font-weight: bold;
font-style: italic;
}
<div></div>

您可以使用 font-style 使内容斜体,使用 font-weight 使内容粗体
div {
font-weight: bold;
font-style: italic;
}
首先在 div 中添加一些文本,因为这将允许您获得差异,然后应用 font-style 的属性:(正常或斜体)。
语言:html
之前 & gt;
& gt;斜体文本之后
language: css
div::before {
content: "text";
color:black;
font-style : italic;
}
<!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>
本站系公益性非盈利分享网址,本文来自用户投稿,不代表码文网立场,如若转载,请注明出处
评论列表(17条)