This zone is sleeping right now! ZzzZZzzz

Better not disturb it! ~You go to the petrol station and buy a slushy instead, everything is cool!~

This area will open again in 000.beats!

(Learn about Swatch Time)

Some other zones are awake :^]


Artifacts Gallery Guilds Search Wiki Login Register

Welcome, Guest. Please login or register. - Thinking of joining?
a Summer day - @686.02 (what is this?)
Activity rating: Four Stars Posts & Arts: 57/1k.beats Random | Recent Posts | Guild Recents
News: ozwomp is requesting your location :ozwomp: [Agree] Guild Events: Summerween Watch-a-thon

+  MelonLand Forum
|-+  Life & The Web
| |-+  ✁ ∙ Web Crafting
| | |-+  ☔︎ ∙ I need Help!
| | | |-+  How do I make a cool custom button


« previous next »
Pages: [1] Print Embed
Author Topic: How do I make a cool custom button  (Read 117 times)
Rubbereon
Full Member ⚓︎
***
View Profile WWWArt


⛺︎ My Room
SpaceHey: Friend Me!
Matrix: Chat!
XMPP: Chat!

Guild Memberships:
Artifacts:
Visited on Melon's 10th Anniversary!Joined 2025!
« on: a Summer night » Embed

I wanted to redesign my site, but give it more of my spice, make it better reflect my personality as an oddball cartoon fanatic furry, so I wanted my links to be buttons and the buttons to be bubbles. I found a helpful tutorial using the border property to make a good-looking outer layer, but now I want a glossy effect inside the buttons too.

This website is kind of what I'm trying to reproduce, well at least the buttons, but Kiophen uses png files for the buttons, I also considered maybe using svg which's what inkscape on linux for, so it's not like I'm out of options, but I'm not exactly familiar with svg it's just too different from bitmap formats.

Logged

https://bettysgraphics.neocities.org/images/animals/cat%20695.gifFuzzy fwiendhttps://bettysgraphics.neocities.org/images/animals/cat%20696.gifhttps://bettysgraphics.neocities.org/images/animals/cat%20697.gif
https://rubbereon.nekoweb.org/img/penguin.gifLinux userhttps://rubbereon.nekoweb.org/img/penguin.gif
You can also find me on Comfybox.
GideonWilhelm
Jr. Member ⚓︎
**
View Profile WWW

⛺︎ My Room

Artifacts:
Visited on Melon's 10th Anniversary!Joined 2025!
« Reply #1 on: a Summer night » Embed

If I recall, it's easy to just export an SVG as a PNG or other bitmap format.  This might be something I fiddle with on the weekend, but I digress.  My first instinct is to open the inspector, and I find in the style editor (at least that's what firefox calls it, just the CSS) it looks like inline style sheet #2 has the jiggle animation when opening the navlinks, as well as some of the info about the navlinks class.  My go-to would be to copy some of those entries and play with them, see how close I can get to the reference.  It's how I rebuilt my page, I used vertpush as a reference to get the basics down

Logged
Rubbereon
Full Member ⚓︎
***
View Profile WWWArt


⛺︎ My Room
SpaceHey: Friend Me!
Matrix: Chat!
XMPP: Chat!

Guild Memberships:
Artifacts:
Visited on Melon's 10th Anniversary!Joined 2025!
« Reply #2 on: a Summer night » Embed

If I recall, it's easy to just export an SVG as a PNG or other bitmap format.  My first instinct is to open the inspector, and I find in the style editor...  My go-to would be to copy some of those entries and play with them, see how close I can get to the reference.  It's how I rebuilt my page, I used vertpush as a reference to get the basics down

I tried to do what you suggested, but I couldn't find any css reference for my use case.


I'm gonna add this too because there's a small chance that I miscommunicated what I meant with "using svg" and why I said "but png...".

1. I have to bake the text directly into the png. maybe there is a hacky way to center the text inside a png, but I'm not a super big fan of that. I already had to do something weird like that for the index page to crop a jpeg and I saw someone else have a problem with displaying a scroll correctly using css on their site because 9 patch just wouldn't work right for them. they eventually figured it out, but it ended up being very hacky, like they had to set the width to 0 to get it working.
2. Svg can be embedded directly into the html code via the <svg> tag. This is why I'm considering it as an option because it is more versatile. Heck if needed, I can probasbly split the svg into multiple pieces to enclose the text in it or use the dedicated svg text element to ditrectly puit any text into the bubble.

Here's the doodle I'm using as a reference and to show what I'm trying to do with the button.


Everything else looks neat, it's the circle shine on the top left that I'm having trouble figuring out how to make.

Here's the code (in css):

Code
.bubblebox {
	border: 1rem solid black; 
	border-radius: 50% 50% 50% 50% / 66% 66% 33% 33%; 
	border-right-width: 0; 
	border-left-width: 0;
	background-color: white;
	box-shadow: 0 0 5px gray inset;
	display: table;
	padding: 20px;
}

Logged

https://bettysgraphics.neocities.org/images/animals/cat%20695.gifFuzzy fwiendhttps://bettysgraphics.neocities.org/images/animals/cat%20696.gifhttps://bettysgraphics.neocities.org/images/animals/cat%20697.gif
https://rubbereon.nekoweb.org/img/penguin.gifLinux userhttps://rubbereon.nekoweb.org/img/penguin.gif
You can also find me on Comfybox.
Dan Q
Hero Member ⚓︎
*****
View Profile WWWArt


I have no idea what I am doing
⛺︎ My Room
RSS: RSS

Guild Memberships:
Artifacts:
Dan Q Cruisin'I DIDN'T meet Dan Q on Melonland!Visited on Melon's 10th Anniversary!
« Reply #3 on: a Summer day » Embed

I had a go at making that something like that button using HTML + CSS only. Here's my HTML (I added lots of bubbles so I could be sure it'd cope with a variety of different "sizes" of bubbles:

Code
<p>
  <a href="#" class="bubblebox">
    Here
  </a>

  <a href="#" class="bubblebox">
    Are
  </a>

  <a href="#" class="bubblebox">
    My
  </a>

  <a href="#" class="bubblebox">
    Bubbles!
  </a>
</p>

<p>
  <a href="#" class="bubblebox">
    This bubble has lots of text so it's bigger!
  </a>

  <a href="#" class="bubblebox">
    This bubble has text<br>
    across two lines!
  </a>
</p>

Then I wrote this CSS. I started with yours, basically (so I hope you were happy with those border-radiuses!). I've added LOTS of comments to explain everything I did. Key points are:

- I put the bubble thickness and color into CSS variables.
- This meant that I could derive the shadow color and inner circle size using CSS calculations. If you change the thickness or color, it has knock-on effects to the derived values too.
- I switched your mixture of rem and px units to just px. Using a mixture like this might throw off people who change the font size in their browser; it CAN be safe, but needs more testing... so I took the easy route and just used pixels (and percentages of container sizes, later).
- I applied a minimum width and an aspect ratio so the bubbles grow proportionally if you put extra text into them
- To do the "little circle", I used a ::after { ... } selector with content: ''; to add a 'virtual' extra element to the page. Then sized and shaped it relative to its parent (the main bubble).


Code
.bubblebox {
  /* Let's put the bubble color in a variable for easy access: */
  --bubble-color: skyblue;
  /* Derive the shadow color by making the bubble color darker: */
  /* (reduce Lightness by 10%, keep Chroma and Hue the same)*/
  --shadow-color: oklch(from var(--bubble-color) calc(l - 0.1) c h);
  /* Put the bubble "shell" width in a variable too: */
  --bubble-thickness: 14px;
  /* Derive the shadow thickness from it (half as thick): */
  --shadow-thickness: calc(var(--bubble-thickness) / 2);
  /* Derive the little circle in the same way: */
  --little-circle-thickness: calc(var(--bubble-thickness) / 3);
  
  /* Display inline, but sizeable: */
  display: inline-block;
  /* Give them a bubbly border: */
  border: solid var(--bubble-color);
  border-width: var(--bubble-thickness) 0; /* (switched rem to px to not mix-units!) */
  border-radius: 50% 50% 50% 50% / 66% 66% 33% 33%; 
  /* White BG with inner shadow: */
  background-color: white;
  box-shadow: 0 0 var(--shadow-thickness) var(--shadow-color) inset;
  /* Always at least 125px wide, and 4/7ths as tall as wide: */
  /* (i.e. 71px tall, but taller if needed to retain proportions) */
  min-width: 125px;
  aspect-ratio: 7/4;
  /* Align the contents to the center */
  text-align: center;
  align-content: center;
  /* Move the text down JUST a little to keep it clear of the little circle (0.95%) and put some padding (equal to the bubble thickness) on the sides so "long" text doesn't burst out of the sides of the bubble: */
  padding: 0.95% var(--bubble-thickness);
  /* Position the "little circle" relative to THIS: */
  position: relative;
  
  /* For the little circle, add a virtual extra element: */
  &::after {
    /* No "content" to this extra element: */
    content: '';
    /* BUT it gets a border a bit like the parent: */
    border: solid var(--bubble-color);
    border-width: var(--little-circle-thickness) 0; /* (switched rem to px to not mix-units!) */
    border-radius: 50% 50% 50% 50% / 66% 66% 33% 33%;
    /* Give it a size relative to its container: */
    /* (little circle is 20% width of the bubble at 8% height)*/
    width: 20%;
    height: 8%;
    /* And gets positioned in the right place: */
    /* (10% from the top of the bubble, 25% from its left) */
    position: absolute;
    top: 10%;
    left: 25%;
  }
}

Here's how it looks:


I've thrown the result onto this Everyone Page if you want to try it.

Logged

https://danq.me/_q26t/badges/dan-q-88x31-lighter.gif https://danq.me/_q26t/badges/dan-q-88x31-peekaboo-scroller.gif https://beige-buttons.danq.dev/beige-buttons-88x31.gif https://embed-html.danq.dev/embed-html-88x31.gif

Artifact Swap: PolyamorousI met Dan Q on Melonland!radio polyDoctor RedactedJoined 2025!
Pages: [1] Print Embed 
« previous next »
 

Melonking.Net © Always and ever was! SMF 2.0.19 | SMF © 2021 | Privacy Notice | Send Feedback | Supporters ♥ Forum Guide | Rules | RSS | WAP | Mobile


MelonLand Badges and Other Melon Sites!

MelonLand Project! Visit the MelonLand Forum! Support the Forum
Visit Melonking.Net! Visit the Gif Gallery! Pixel Sea TamaNOTchi
MelonLand @000

Want to Login or Join ?

Minecraft: Online
Join: craft.melonking.net