gpt4 book ai didi

html - 右浮动链接变高

转载 作者:太空宇宙 更新时间:2023-11-04 00:12:56 25 4
gpt4 key购买 nike

我遇到了一个链接的问题,当向右浮动时,链接的高度比不向右浮动的链接高。这是生成它的最少代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style>
body {font: normal 12px/1.6 Arial; }
.btn {background-color: Red; color:#000; padding: 5px 15px 5px 15px; }
</style>
</head>
<body>
<div>
<a class="btn" href="#">Nice link</a>
<a class="btn" style="float: right;" href="#">Bad link</a>
</div>
</body>
</html>

This is the result. The "Bad link" is higher then the "Nice link".

如果我从主体样式中删除“Arial”,它看起来没问题。但我当然需要字体样式。

最佳答案

填充仅适用于 block 元素,我猜由于 float ,坏链接就像 block 一样,将 display:block 添加到 .btn 并将好的链接 float 到左侧

http://jsfiddle.net/4Qs5J/

关于html - 右浮动链接变高,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12401466/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com