Jump to content

Highlighted Text CSS

Recommended Posts

Hi, I'm trying to highlight particular text lines with this code, below. It all works great apart from when I've added the code my text lines go left-justified rather than centered despite "text edit" showing center.

 

Any tips?

 

--

// Highlighted Text //

h2 {
  background-image: linear-gradient(to top, #fcd5ce 50%, transparent 50%);
  width: auto;
  display: inline;
  }
h3 {
  background-image: linear-gradient(to top, #ffe5d6 50%, transparent 50%);
  width: auto;
  display: inline;
  }
h4 {
  background-image: linear-gradient(to top, #f8edeb 50%, transparent 50%);
  width: auto;
  display: inline;\h2 {
  background-image: linear-gradient(to top, #fcd5ce 50%, transparent 50%);
  width: auto;
  display: inline;
  }
  }

Link to comment
  • Replies 2
  • Views 528
  • Created
  • Last Reply
20 hours ago, tuanphan said:

Hi. If you use display inline

text-align: center won't work.

Can you share link to page where text on. We can take a look?

Hi, thank you for your answer!

What should I change in the code to have highlighted text that I can change around in the text editor in terms of alignment? 

I'm doing a private client project and don't really want to share it publicly 😬

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.