Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

different font color for two words within a paragraph


georgia-shc

Question

4 answers to this question

Recommended Posts

  • 0

The only CSS selectors I know of would be for first letter or first line.  There is no means to select first-word(2).

The only way to achieve and maintain this for multiple pages would be with an html code block, where you could place the first 2 words inside a span and specify a class.

That class could be changed in one location to update all instances it has been used.

eg:

<p><span class="p-first-two">Lorem ipsum</span> dolor sit amet, consectetur adipiscing elit. Illa tamen simplicia, vestra versuta. Ratio quidem vestra sic cogit. Respondeat totidem verbis. <p>

then in CSS you could set the colour, size etc:

.p-first-two{
    color: gray;
}

 

Outside of this you would require javascript.  The only one that comes to mind for this purpose is https://github.com/davatron5000/Lettering.js

 

Contact Us for detailed help

Common Squarespace Tips

Sharing Your Site Link

Squarespace web designers in Perth WA.

Link to comment
  • 0

if I use an html block, will that block inherit all the other style settings or do I have to start from scratch with everything: font size (all screen sizes), font style, margin, padding, etc. Thanks again.

Link to comment
  • 0
12 hours ago, georgia-shc said:

if I use an html block, will that block inherit all the other style settings or do I have to start from scratch with everything: font size (all screen sizes), font style, margin, padding, etc. Thanks again.

It will inherit any style given to p.  If you have any other paragraph styles (eg: i you have small paragraph, medium paragraph) you will need to add the class for that in your code as well.

Contact Us for detailed help

Common Squarespace Tips

Sharing Your Site Link

Squarespace web designers in Perth WA.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...