8

I am trying to make a button in css like this one

but I have no idea how to do it as I am new to css. This is what I tried:

.gbtnHollow  {
     background:  transparent;
     height:  38px;
     line-height:  40px;
     border:  2px solid white;
     display:  inline-block;
     float:  none;
     text-align:  center;
     width:  120px;
     padding:  0px!important;
     font-size:  14px;
     color:  #fff;
 }

.gbtnHollow:hover  {
     color:  #fff;
     background:  rgba(255, 255, 255, 0.2);
 }
4
  • 3
    Can't see anything wrong there mate, It should work. Demo.
    – Harry
    Commented Aug 25, 2014 at 11:30
  • you want to add something in background as it is in that image ?
    – Khaleel
    Commented Aug 25, 2014 at 11:31
  • 1
    @Harry thanks, i re-opened notepad++ and it fixed itself. Commented Aug 25, 2014 at 11:34
  • @TomTriumphentGames: That is kind of strange mate but good to know that your problem is solved :)
    – Harry
    Commented Aug 25, 2014 at 11:37

4 Answers 4

6

It's very simple, set background: none; to button. JSFiddle

4
button {
    background-color: Transparent;
    background-repeat:no-repeat;
    cursor:pointer;
    overflow: hidden;
    outline:none;
}

Add this and customize it for you. Example is here on Fiddle

4

enter image description here enter image description here

#button {
     width: 150px;
     height: 50px;
     border:none;
     border:solid 2px black;
     border-radius: 5px;
     background: rgba(255, 255, 255,0);
     font-size: 25px;
}

#button:hover {
     background:black;
     color:white; 
}
1
  • 1
    While this code may answer the question, providing additional context regarding how and/or why it solves the problem would improve the answer's long-term value. Please read this how-to-answer for providing quality answer. Commented Jun 17, 2017 at 11:49
1

Its simple. add this css to button:

button {
    background: none;/*this for transparent button*/
    border: 1px solid black;/* this is for button border*/
    position: relative;
    left: 150px;
    top: 80px;
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.