Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML CSS Invisible Button

Tags:

Hello I am trying to make an invisible button (still functional and clickable), because my buttons styles are embedded in the background and I don't want to slice them, and do it all from beginning.

So I just want to make a button, put it on the part of the background where the button should be and make it invisible so the background button image can be seen and clicked.

Any suggestions? Thank you very much!

like image 829
user1880779 Avatar asked Dec 21 '12 12:12

user1880779


People also ask

How do you make a button invisible in HTML CSS?

You can use <map> element instead.

How do you hide a button in CSS?

You should add display: none; to yor button style to hide. this will not work! display:none will hide the entire button for sure, but will also hide the text of the button, as that is part of the button!

How do you hide content in CSS?

You can hide an element in CSS using the CSS properties display: none or visibility: hidden . display: none removes the entire element from the page and mat affect the layout of the page. visibility: hidden hides the element while keeping the space the same.


2 Answers

you must use the following properties for a button element to make it transparent.

Transparent Button With No Text

button {

    background: transparent;
    border: none !important;
    font-size:0;
}

Transparent Button With Visible Text

button {

    background: transparent;
    border: none !important;
}​

and use absolute position to position the element.

For Example

you have the button element under a div. Use position : relative on div and position: absolute on the button to position it within the div.

here is a working JSFiddle

here is an updated JSFiddle that displays only text from the button.

like image 94
Amyth Avatar answered Sep 22 '22 08:09

Amyth


You can use CSS to hide the button.

button {
  visibility: hidden;
}

If your <button> is just a clickable area on the image, why bother make it a button? You can use <map> element instead.

like image 39
xiaoyi Avatar answered Sep 18 '22 08:09

xiaoyi