gpt4 book ai didi

html - 如何设置多个元素的样式以将它们固定为 100% 宽度?

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

我有这个代码

...
<div>
<label>Identification:</label>
<input type="text" name="identification" value="" maxlength="20">
<strong class="characters">20</strong>
<p class="description">
<span class="icon_description"></span>Item description
</p>
</div>
...

现在看起来像这张图 enter image description here

我需要将其改进为父元素的 100%。因此 label 可以固定为特定宽度,其余元素固定为剩余宽度空间。请问如何通过 css3 为跨浏览器做到这一点?

最佳答案

您好,我更正了一些代码。以下代码适用于所有浏览器。

<!Doctype>
<html>

<body>
<div style="width:500px;margin-top:40px;">
<label style="width:86px;float:left;">Identification:</label>

<div style="width:404px;float:right;margin-left:10px;">
<input type="text" name="identification" value="" maxlength="20" style="width:45%;">
<strong class="characters" style="width:10%;">40</strong>
<h4 style="width:45%;float:right;margin-top:0px;">Item description</h4>
</div>
</div>
</body>
</html>

关于html - 如何设置多个元素的样式以将它们固定为 100% 宽度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50654330/

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