Skip to content
Sign upLog in
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
3

how to add images to your button in CSS?

potatojs
potatojs

hi i want to know how to add images to your html button element using CSS?

2 years ago

Voters

Comments

TopNew
1
zplusfour
zplusfour

u can
Just make for an image a onclick option

2 years ago
1
zplusfour
zplusfour

@potatojs

HTML:

<script> function click(){ alert('CLICKED!') } </script> <img src="image.png" onclick="click()">

Oh srry u order CSS
no css is 'carcading style sheets' it is not functional
So you can do it only with JS

2 years ago
1
zplusfour
zplusfour

@potatojs
thank you for the 5 cycles :D

2 years ago
1
zplusfour
zplusfour

@potatojs
CSS isn't a functional language
so u shouldn't be sad :D

2 years ago
1
Coder100
Coder100

Sorry, you can't do that. Use JS.
However, there is a :before and :after tag that can append text:

div::before { content: "This is text only."; } div::after { content: "This is text only."; }
2 years ago
Load more