Jump to content

How to keep padding on heading text highlight when line breaks

Recommended Posts

 

I'm using the following code to add a highlight to my h2 when bolded but the highlight is abrupt when the line breaks in mobile or smaller browser size. Is there a better way to do this so that the highlight feels more like a background around all letters with equal space?

   
h2 strong {
  background: #1b1b1a;
  padding-top: 7px;
  padding-bottom: 7px;
  font-weight:normal !important;
}

 

URL: https://cantina-loca.squarespace.com/

Password: 8989

1856486637_ScreenShot2021-10-20at12_52_15AM.thumb.png.a6ae41ca8349392f1d76eb61512835b6.png

Link to comment
  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

9 hours ago, lamdra said:

 

I'm using the following code to add a highlight to my h2 when bolded but the highlight is abrupt when the line breaks in mobile or smaller browser size. Is there a better way to do this so that the highlight feels more like a background around all letters with equal space?

   
h2 strong {
  background: #1b1b1a;
  padding-top: 7px;
  padding-bottom: 7px;
  font-weight:normal !important;
}

 

URL: https://cantina-loca.squarespace.com/

Password: 8989

1856486637_ScreenShot2021-10-20at12_52_15AM.thumb.png.a6ae41ca8349392f1d76eb61512835b6.png

It seems that you 've solved your issue on your own, doesn't it?

image.png.b449d66d7df8e50645db90bd42a18002.png

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date format)
💫 Animated Buttons (Referral URL)
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment
4 minutes ago, bangank36 said:

It seems that you 've solved your issue on your own, doesn't it?

No, I haven't actually. I worked around it for now by doing a hard return and adding a space before the line. But that's not ideal. Do you know how I can fix this without the forced return?

Link to comment
2 hours ago, lamdra said:

No, I haven't actually. I worked around it for now by doing a hard return and adding a space before the line. But that's not ideal. Do you know how I can fix this without the forced return?

Still happens on longer headlines where I can't control the line breaks.

1574470603_ScreenShot2021-10-20at2_00_44PM.thumb.png.436f66e7d7c2de771f5a78768221619b.png

Link to comment
On 10/28/2021 at 10:30 AM, lamdra said:

@bangank36 @tuanphan Any thoughts? Site is no longer password protected. You can recreate the issue on mobile version of this page

https://www.cantinaloca.com/our-story

Thanks for your help!

How do you want the text to appear on the desktop-tablet-mobile?

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
On 10/30/2021 at 7:37 PM, tuanphan said:

How do you want the text to appear on the desktop-tablet-mobile?

 

I'd like there to be padding on the left of the text when it drops down a line. The way "Call Loca" looks is what I'm after but unless I manually add a return and a space I can't get it. For example what you see before "Time" is what it looks like if it just automatically drops a line in smaller screens.

Is there a way to keep that left padding even when the sentence breaks into multiple lines?

Screen Shot 2021-10-20 at 2.00.44 PM.png

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...

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.