Jump to content

Custom CSS code not working with <a> elements

Go to solution Solved by creedon,

Recommended Posts

Hello, 

My site is not public yet so not sure how to make it visible but this is the problem I'm having. I had several custom buttons made that are pop-ups for our payment processor and contact forms. All the custom styles do not work when applied to an <a> element. I was able to make all the styling apply when I changed the <a> elements to a <p> element and took the href link out, so I know the code works, it just doesn't work with an <a> element and I'm not sure why. 

Link to comment
  • Replies 6
  • Views 1.1k
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

Here's the code I was using. Like I said, when I swap out the <a> for a <p> element, remove the href, and change it accordingly in the CSS the styles then apply. 

In the <> block:

<a class=“g_button” href="https://fumcpdx.churchcenter.com/giving?open-in-church-center-modal=true">

  Give Online Now

</a>

In the custom CSS:

/* Give Button Styling */

a.g_button {

background: #D34B2A;

color: #F5F1E9;

  text-transform: Uppercase;

font-family: “Merriweather”, serif;

text-align: center;

  letter-spacing: 1.5px;

font-weight: 600;

font-size: 1.2em;

  padding:15px 50px 15px 50px;

  border: none;

  border-radius:5px;

  display: inline-block;

}

 

a.g_button:hover {

  background: #EB693B;

}

Link to comment

Please post the URL for a page on your site where we can see your issue. For us to see the URL you need to include the link in the content of your post. The URL field the forum software provides is not shown to us.

A link to the backend of the your site won’t work for us, i.e. a URL that contains /config/.

Please set up a site-wide password, if your site is not public and you've not already done so.

Post the password here.

Adding a site-wide password does not allow anyone to alter your site. It only allows those with the password to see your site.

Please read the site-wide password and how to share a link documentation to understand how they work.

You may find How to post a forum question post useful.

We can then take a look at your issue.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment

I don't know where that code is that you're showing. That's not how I have it right now. I was going back between trying different ways to get the CSS to apply so was using a "test" class, but that's not how it is now so not sure where you pulled that code. 

 

Screenshot 2024-05-06 at 4.20.45 PM.png

Screenshot 2024-05-06 at 4.20.56 PM.png

Link to comment
  • Solution
Quote

I don't know where that code is that you're showing. That's not how I have it right now.

It was the code from your page when I loaded it. It has been changed since then.

Screenshot2024-05-06at4_39_04PM.thumb.png.8c00131ad93c31ed41541ae6a240f9a4.png

The issue remains. You need to not use smart quotes, use dumb quotes as in the example I showed.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

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.