gpt4 book ai didi

html - CSS 需要内联元素出现在 { 显示 : block; } element 旁边

转载 作者:行者123 更新时间:2023-11-28 13:51:21 24 4
gpt4 key购买 nike

我正在尝试在另一个元素旁边引入一个复选框。问题在于 a 元素已被 CSS 设为“ block ”,因此它以正确的高度和宽度出现。作为一个 block ,我不能简单地将另一个元素放在它旁边并希望它出现在那里 - 它出现在它的正下方。

下面显示了一个独立的示例。

<html>
<head>
<style type='text/css'>
/* I don't have control over this */
a.btn {
background-color: #B35905;
color: #E6D389;
text-decoration: none;
font-weight: bold;
text-align: center;
display: block;
border: none;
cursor: pointer;
}
.normal{
line-height: 20px;
font-size: 12px;
height: 20px;
width: 125px;
padding: 0px;
margin: 0px;
}
</style>
</head>
<body>

<!-- I have some control over this -->
<a class="btn normal">Push Me</a><input type="checkbox">
<br>
<a class="btn normal">Push Me Too</a>
</body>
</html>

所以我正在寻找的是立即出现在元素右侧的复选框,但不必完全弄乱按钮的样式。使用按钮的(已知)大小的复选框的绝对定位似乎是错误和肮脏的。

建议?

最佳答案

<a class="btn normal" style="float: left;">Push Me</a><input type="checkbox">
<br style="clear: both;">
<a class="btn normal">Push Me Too</a>

关于html - CSS 需要内联元素出现在 { 显示 : block; } element 旁边,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1730495/

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