Jump to content

How do I set background colour to fill the entire code block container?

Recommended Posts

  • Replies 10
  • Views 155
  • Created
  • Last Reply

Top Posters In This Topic

Posted

Hi @abibacon, sorry for any confusion but I'm not struggling to target the blocks. I've created a code block and set up a div class called "benefits". Then in the CSS I've set the background colour to be grey. The grey background appears but does not extend the full length of the code block container as you can see in the screenshot above.

Posted
On 11/21/2024 at 4:44 PM, benstevens05 said:

Use this to Website Tools > Custom CSS

@media screen and (min-width:768px) {
.fe-673d04d09478f641b87ed275 div.code-block>div>div {
    min-height: 350px;
}
}

 

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

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Posted

Try it!

Add this code into custom css:

.benefits {
  background: #f8f8f8;
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  display: inline-block; /* Ensures the box fits tightly around content */
  width: 100%; /* Ensure it spans the full width of its parent container */
  box-sizing: border-box; /* Includes padding and border in width calculation */
}

 

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.