Jump to content

How can I use a <span> to target a single letter of a button on :hover

Recommended Posts

Posted (edited)

Site URL: https://florianbrooks.squarespace.com

Site: https://florianbrooks.squarespace.com

Password: florian

 

Hey,

I'm trying to wrap a single letter on a button in a span so I can target it with CSS for a hover effect. Any ideas how I can achieve this?

I have recreated a SQSP button inside a code block to show how this would look but, 'm guessing this work around would mess with the client's button conversion analytics and it's going to be impossible for me to use this workaround for other block buttons such as the form buttons etc.

Any help would be AMAZING!

TIA

Nick

Here is what I've done for the work around

Code block html:

<!--FAKE BUTTON COPY IN CODE BLOCK -->
<div class="sqs-block button-block sqs-block-button" data-block-type="53" id="block-yui_3_17_2_1_1643232400177_2264"><div class="sqs-block-content" id="yui_3_17_2_1_1643720042987_387">

<div class="sqs-block-button-container--center" data-animation-role="button" data-alignment="center" data-button-size="medium" data-button-type="primary" id="yui_3_17_2_1_1643720042987_386">
	<a href="" class="sqs-block-button-element--medium sqs-button-element--primary sqs-block-button-element" data-initialized="true">
    Bo<span class="btn-o-float">o</span>k Now
  </a>
</div>
</div></div>

And the CSS so far:

/* === FAKE BUTTON HOVER EFFECT === */
.sqs-block-button-element:hover .btn-o-float {
  color: red;
  position: relative;
  font-size: smaller;
  top: -3px;
  margin: 0.09em;
}

 

Edited by nickstein
typo
  • nickstein changed the title to How can I use a <span> to target a single letter of a button on :hover
  • Replies 1
  • Views 634
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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.