I was trying to color just first WORD of sentence
<div class="logoS">Title Of The Page</div>
CSS which am using is
.logoS{
padding: 0px;
float: left;
font-family: 'Open Sans', Helvetica, Arial, sans-serif;
color: white;
border:solid 1px black;
font-weight: bold;
font-size: 22px;
}
.logoS::nth-word(1) {
margin-right: 20px;
}
i just want to color "TITLE" not other words, any solution
Try this, hope this will help .
.logoS:before {
color: red;
content: "Title ";
}
<div class="logoS">Of The Page</div>
The code
<div class="logoS"><span id="first">Title</span> Of The Page</div>
.logoS{
padding: 0px;
float: left;
font-family: 'Open Sans', Helvetica, Arial, sans-serif;
color: blue;
border:solid 1px black;
font-weight: bold;
font-size: 22px;
}
#first {
margin-right: 20px;
color: red;
}
Use a span with preferred style for the first word like
<div class="logoS"><span class="spanstyle">Title </span>Of The Page</div>
// CSS
.spanstyle {
color:blue;
}
Check this link . There is :first-letter
and :first-line
, but no :first-word
.
Use a span tag, this way it won't start a new line. For example:
<div class="logoS"><span id="title">Title</span> Of The Page</div>
and then in your css just add:
#title{
color: red
}
Hope this works!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With