开发者

Doing a bar of buttons with CSS: problems with display:block, paddings and <li />s

开发者 https://www.devze.com 2023-03-14 00:37 出处:网络
I\'m doing a horizontal bar of buttons with CSS so I can have something like this: +-----------+------------+-------------+------------+

I'm doing a horizontal bar of buttons with CSS so I can have something like this:

+-----------+------------+-------------+------------+
| Button 1  | Button 2   | Button 3    | Button 4   |
+-----------+------------+-------------+------------+

But I don't understand why my button text is bigg开发者_开发技巧er than the <li />that contains that <a />. I've done a jsfiddle example to show what happens, you can check it here: http://jsfiddle.net/7m4rE/ .

How I can solve this problem? I'm only supporting IE9+ and last Chrome, FF, Opera.

Thank you in advance


Don't set an explicit height on either your li or your a. Rather, let your padding and margin on the a determine how tall the elements will be.

Fiddle: http://jsfiddle.net/7m4rE/1/

0

精彩评论

暂无评论...
验证码 换一张
取 消