简体   繁体   中英

Arranging buttons side by side

please help me arrange these 3 buttons horizontally like this photoshopped image:

用Photoshop制作

Please take a look at the code here .

CSS:

a.facebookbt {
    background: url(http://i1068.photobucket.com/albums/u445/neobx/bonus5.png) no-repeat 0 0;
    width: 132px;
    height: 52px;
    display: block;
}
a.facebookbt:hover { background-position: 0 -52px; }
a.facebookbt:active { background-position: 0 -104px; }

a.twitterbt {
    background: url(http://i1068.photobucket.com/albums/u445/neobx/bonus5.png) no-repeat -132px 0;
    width: 132px;
    height: 52px;
    display: block;
}
a.twitterbt:hover { background-position: -132px -52px; }
a.twitterbt:active { background-position: -132px -104px; }

a.abpbt {
    background: url(http://i1068.photobucket.com/albums/u445/neobx/bonus5.png) no-repeat -265px 0;
    width: 286px;
    height: 50px;
    display: block;
}
a.abpbt:hover { background-position: -265px -52px; }
a.abpbt:active { background-position: -265px -104px; }​

HTML:

<a class="facebookbt" href="javascript:;"></a>

<a class="twitterbt" href="javascript:;"></a>

<a class="abpbt" href="javascript:;"></a>​

How about:

a {
    float:left;
}
​

or

a {
    display:inline-block !important;
}
a { float:right; margin-left: 5px;}

and change the html markup to this way:

<a class="abpbt" href="javascript:;"></a>
<a class="twitterbt" href="javascript:;"></a>
<a class="facebookbt" href="javascript:;"></a>

This way the layout will be aligned to the right , and in the correct order like in your screenshot.

Demo : http://jsfiddle.net/FzYkJ/12/

You can add

float:left; 

to each button

http://jsfiddle.net/FzYkJ/2/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM