Adding custom HTML and CSS to Bubble elements

Viewed a few videos on how to add custom HTML and CSS to elements. I want to style a hover effect for a button using this sample code from Code Pen

I’ve tried every combination to get this hover button to work in Bubble, at least, I think I have (wink).

I have enable the ID attribute, added a HTML element on the page, installed Classify plugin, I put the HTML portion of the code in the HTML element and the CSS portion on the index page, I’ve set the HTML element ID to the div container, button, learn-more, etc.

I feel like I’m missing a key detail to make this hover effect work or maybe its the div container in the code that’s complicating things. Any assistance would be helpful and greatly appreciated!

Maybe share some screenshots of your code, where and how you’ve added it (I’m not quite sure what you mean by putting the CSS portion on the Index), HTML elements, button element etc…


Thanks for the response.
1st screenshot…I copied the CSS code to the index page’s HTML Header
2nd screenshot…I copied the HTML code to a HTML element on the page (learn more button)

I think what I’m doing is wrong or the wrong sequence. If I can be shown how to display the hover effect using the code, that would be great.

Well… I can’t see much of your CSS code, so can’t comment on that…

But I can see that you’re on the Free plan…

‘Page HTML Headers’ aren’t available on the free plan… so move the CSS into the same HTML element (or another one), above the Button to see if that works…

1 Like

Ok, will try that now…here’s the full code:

HTML Code

Learn More

CSS Code

@import url(‘https://fonts.googleapis.com/css?family=Mukta:700’);

$bg: #f3f8fa;
$white: #fff;
$black: #282936;

@mixin transition($property: all, $duration: 0.45s, $ease: cubic-bezier(0.65,0,.076,1)) {
transition: $property $duration $ease;
}

  • {
    box-sizing: border-box;
    &::before, &::after {
    box-sizing: border-box;
    }
    }

body {
font-family: ‘Mukta’, sans-serif;
font-size: 1rem;
line-height: 1.5;
display: flex;
align-items: center;
justify-content: center;
margin: 0;
min-height: 100vh;
background: $bg;
}

button {
position: relative;
display: inline-block;
cursor: pointer;
outline: none;
border: 0;
vertical-align: middle;
text-decoration: none;
background: transparent;
padding: 0;
font-size: inherit;
font-family: inherit;
&.learn-more {
width: 12rem;
height: auto;
.circle {
@include transition(all, 0.45s, cubic-bezier(0.65,0,.076,1));
position: relative;
display: block;
margin: 0;
width: 3rem;
height: 3rem;
background: $black;
border-radius: 1.625rem;
.icon {
@include transition(all, 0.45s, cubic-bezier(0.65,0,.076,1));
position: absolute;
top: 0;
bottom: 0;
margin: auto;
background: $white;
&.arrow {
@include transition(all, 0.45s, cubic-bezier(0.65,0,.076,1));
left: 0.625rem;
width: 1.125rem;
height: 0.125rem;
background: none;
&::before {
position: absolute;
content: ‘’;
top: -0.25rem;
right: 0.0625rem;
width: 0.625rem;
height: 0.625rem;
border-top: 0.125rem solid #fff;
border-right: 0.125rem solid #fff;
transform: rotate(45deg);
}
}
}
}
.button-text {
@include transition(all, 0.45s, cubic-bezier(0.65,0,.076,1));
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
padding: 0.75rem 0;
margin: 0 0 0 1.85rem;
color: $black;
font-weight: 700;
line-height: 1.6;
text-align: center;
text-transform: uppercase;
}
}
&:hover {
.circle {
width: 100%;
.icon {
&.arrow {
background: $white;
transform: translate(1rem, 0);
}
}
}
.button-text {
color: $white;
}
}
}

@supports (display: grid) {
body {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-gap: 0.625rem;
grid-template-areas: “. main main .” “. main main .”;
}

#container {
grid-area: main;
align-self: center;
justify-self: center;
}
}

HTML code

div id=“container”
button class=“learn-more”>
span class=“circle” aria-hidden=“true”>
pan class=“icon arrow”>
/span>
span class=“button-text”>Learn More
/button>
/div>

had to take the beginning brackets off so the code can be displayed.

I tried your solution, didn’t work. I actually tried a much simpler CSS code and did not work either. Maybe, I need to have the plan plan for any custom HTML/CSS code :frowning:.

Here there,

Figured it out!!! I created a fresh page and re-installed the Classify plugin and now everything is rendering. Not sure why it was giving me a hard time. I have to play around with the custom code and I do see Bubble’s code overwriting the custom code on buttons especially but I can work with it for now. Thanks for the help!!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.