Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a square button

Tags:

css

I have a button on my website and I want to make it square:

How do a make a square button and make it still act like a button so it changes a little bit when i scroll over it

here is my example: note that the button can't be clicked on

http://jsfiddle.net/HrUWm/

(what css will make this work?) here is what i tried:

<input class="butt" type="button" value="test"/>
.butt{ border: 1px outset blue;  background-color: lightBlue;}
like image 449
Crushinator Avatar asked Apr 05 '13 00:04

Crushinator


People also ask

How do I make a button Square in bootstrap?

Side note: If you're trying to make the corners square, bootstrap has a class that controls border-radius so to make a button with square corners, you could simply add the "rounded-0" class to the button's classes.


2 Answers

This will do the work:

.butt {
   border: 1px outset blue;
   background-color: lightBlue;
   height:50px;
   width:50px;
   cursor:pointer;
}

.butt:hover {
   background-color: blue;
   color:white;
}

http://jsfiddle.net/J8zwC/

like image 151
Miguel Avatar answered Oct 09 '22 11:10

Miguel


Example: http://jsfiddle.net/HrUWm/7/

.btn{
   border: 1px solid #ddd;
   background-color: #f0f0f0;
   padding: 4px 12px;

    -o-transition: background-color .2s ease-in; 
    -moz-transition: background-color .2s ease-in;
    -webkit-transition: background-color .2s ease-in; 
    transition: background-color .2s ease-in; 
}

.btn:hover {
    background-color: #e5e5e5;    
}

.btn:active {
    background-color: #ccc;
}

The key piece is the selectors matching the :active and :hover states of the button, to allow a different style to be applied.

See also: The user action pseudo-classes :hover, :active, and :focus

like image 26
Tim M. Avatar answered Oct 09 '22 09:10

Tim M.