質問

I have a HTML of <span> Day Month </span>

and for CSS I want to target Day seperately and Month seperately (apply different styles to them) without changing the HTML.

How can I do it?

役に立ちましたか?

解決

Yeah its possible. You can follow this method. Here font-word is not posible, that have no option in css. But we use content css property

<!DOCTYPE html>
<html>
<head>
<style>
span {
color: orange;
    }
span:before
{
color: red;
content: "Day";
position: absolute;
}
</style>
</head>
<body>
<span>Day Month </span>
</body>
</html>

Updated: Here the fiddle Demo

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top