gpt4 book ai didi

html - 标签没有在 div 的左侧排列

转载 作者:行者123 更新时间:2023-11-28 16:37:05 24 4
gpt4 key购买 nike

我有几个单选按钮,它们被带有背景图像的标签隐藏和覆盖。我的问题是标签没有在 div 的左侧对齐,而是在靠近中间的某个地方排列。几个小时以来,我一直在努力解决这个问题,但无法弄清楚。我的网站可以在这里看到:http://envisionhomedesign.com/derek/test12/index.html

CSS:

.button {
visibility:hidden;
clip:rect(0 0 0 0);
position: absolute;
}
label {
background-image: url("Images/Blue Button.png");
background-size: 130px;
background-repeat: no-repeat;
width: 130px;
height: 30px;
display: block;
float: left;
margin-right: 50px;
text-align:center;
font-size:small;
font-weight: 700;
padding-top:7px;
font-family: 'Lucida Sans Unicode, Lucida Grade, sans-serif';
}

.button:checked + label {
background-image: url("Images/Clicked Button.png");}
input[type=button] {
font-family: 'ubuntu', sans-serif;
width: 130px;
height:30px;
background:transparent;
float:none;}

HTML:

<div id="leftcolumn">
<div id="buttonDeadspace"></div>
<form action="#">
<ul>
<li>
<input type="radio" class="button" name="buttonGroup" onclick="Roof_Stylei_HipGroup();" id="button0a" checked/>
<label for="button0a">Roof Style: Hip</label>
</li>
<li>
<input type="radio" class="button" name="buttonGroup" onclick="Roof_Stylei_GableGroup();" id="button0b" />
<label for="button0b">Roof Style: Gable</label>
</li>
</ul>
</form>
<div id="buttonGuide0">Click above to begin</div>
<div id="groups0" style="visibility:hidden">
<form action="#">
<ul>
<li>
<input type="radio" class="button" name="buttonSubGroup" onclick="Board_n_Batten();" id="button01" checked/>
<label for="button01" onmouseover="mouseOver('Board_n_BattenMouseover');" onmouseout="mouseOff('Board_n_BattenMouseover');">Board & Batten</label>
</li>
<li>
<input type="radio" class="button" name="buttonSubGroup" onclick="Door();" id="button02" />
<label for="button02" onmouseover="mouseOver('DoorMouseover');" onmouseout="mouseOff('DoorMouseover');">Door</label>
</li>
<li>
<input type="radio" class="button" name="buttonSubGroup" onclick="Garrage_Door();" id="button03" />
<label for="button03" onmouseover="mouseOver('Garrage_DoorMouseover');" onmouseout="mouseOff('Garrage_DoorMouseover');">Garrage Door</label>
</li>
<li>
<input type="radio" class="button" name="buttonSubGroup" onclick="Roof();" id="button04" />
<label for="button04" onmouseover="mouseOver('RoofMouseover');" onmouseout="mouseOff('RoofMouseover');">Roof</label>
</li>
<li>
<input type="radio" class="button" name="buttonSubGroup" onclick="Shake();" id="button05" />
<label for="button05" onmouseover="mouseOver('ShakeMouseover');" onmouseout="mouseOff('ShakeMouseover');">Shake</label>
</li>
<li>
<input type="radio" class="button" name="buttonSubGroup" onclick="Siding();" id="button06" />
<label for="button06" onmouseover="mouseOver('SidingMouseover');" onmouseout="mouseOff('SidingMouseover');">Siding</label>
</li>
<li>
<input type="radio" class="button" name="buttonSubGroup" onclick="Stone();" id="button07" />
<label for="button07" onmouseover="mouseOver('StoneMouseover');" onmouseout="mouseOff('StoneMouseover');">Stone</label>
</li>
<li>
<input type="radio" class="button" name="buttonSubGroup" onclick="Trim();" id="button08" />
<label for="button08" onmouseover="mouseOver('TrimMouseover');" onmouseout="mouseOff('TrimMouseover');">Trim</label>
</li>
<li>
<input type="radio" class="button" name="buttonSubGroup" onclick="Window();" id="button09" />
<label for="button09" onmouseover="mouseOver('WindowMouseover');" onmouseout="mouseOff('WindowMouseover');">Window</label>
</li>
</ul>
</form>
</div>
<div id="buttonDeadspace"></div>
</div>

最佳答案

大多数浏览器都会向 ul 元素添加一些填充和边距。这种样式会导致您在左栏中的内容移动并溢出。您可以显式设置此填充/边距以覆盖浏览器细节。

ul { padding:0; margin:0; }

关于html - 标签没有在 div 的左侧排列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26854168/

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