How to add required styles to text with specific fonts?

Viewed 68

I want all text on my site with the font name 'classylight' to have a letter spacing and word spacing of 50px each.

Defining a class in the site map and adding class names for each post is a time consuming process.

To reduce the time, I tried to solve this issue with the attribute*=style property.

I tried -

body ["style=font-family:classylight"] {
letter-spacing:50px;
word-spacing:50px; 
}

It's not working. Can anyone help? I would prefer css for this. If there's no possibility in css, please refer with javascript, jquery.

PS - I'm not looking for answers which adds styles directly to body part like

p {
font-family: classylight;
letter-spacing:50px;
word-spacing:-20px; 
}
<p>text</p>

Or

.classylight {
   font-family: classylight;
    letter-spacing:50px;
    word-spacing:-20px;
}
<p class="classylight">text</p>

These are time consuming as I use different fonts for different lines for different paras for different posts!!!

2 Answers

if you have own fonts.css then u can directly add css letter-spacing:50px; word-spacing:50px; on your font css file

Try this and add reference of the css file in your main html page.

body  {
letter-spacing:50px;
word-spacing:50px; 
font-family:classylight;
}
Related