gpt4 book ai didi

css - 同一个 div 不同设计的浏览器

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

我有几个不同的问题。

我有一个 div,里面有几个其他的 div 和一些控件。我最大的问题是它在 Chrome 中看起来与在其他浏览器中看起来不一样。现在,它看起来如下所示: Properties box in different browsers

最大的问题是 Chrome,其中“width:”文本右侧的文本框向下延伸到下一行。盒子的代码可以在this JSFiddle中看到或者如下:

<div id="div_properties" class="redBorder left" style="clear: left; display: 
<div class="right">
<a href="#" id="closePropertiesWindow">
<img src="close.png" title="Close window"></a>
</div>
<div class="centered noMargin whiteBackground">
<h3 class="noMargin">Properties</h3>
</div>
<hr class="noMargin noPadding">

<div id="div_properties_content" style="display: block;">
<div class="noMargin propertiesControl" prop="text" style="width:100%;">
text:
<input type="text" id="propertytextTextBox" class="right"></input>
</div>
<div class="noMargin propertiesControl" prop="width" style="width:100%;">
width:
<input type="number" id="propertywidthNumber" class="right"></input>
</div>
<div class="noMargin propertiesControl" prop="italic" style="width:100%;">
italic:
<input type="checkbox" id="propertyitalicCheckBox" class="right" checked="checked">
</div>
<div class="noMargin propertiesControl" prop="bold" style="width:100%;">
bold:
<input type="checkbox" id="propertyboldCheckBox" class="right">
</div>
<br>
<input type="button" id="savePropertiesButton" value="Save" class="right">
</div>
</div>

CSS 如下:

#div_properties {
margin-top: 5px;
background-color: #F0F0F0;
width: 300px;
float: left;
min-height: 75px;
}

.redBorder {
border: 1px solid red;
}

.noMargin {
margin: 0 0 0 0;
}

.left {
float: left;
}

.right {
float: right;
}

(这些都是这个范围内的所有相关类,在元素上定义的其他类没有样式,但正在 JavaScript 中使用。)

此外,我遇到的另一个问题是 IE 中关闭图像周围的“框边框”。这不是什么大问题,但如果有人知道是什么原因造成的,那就太好了。

最佳答案

导致问题的是 float 。您需要清除它们。

.propertiesControl {
clear:both;
}

http://jsfiddle.net/JWDkM/2/

关于css - 同一个 div 不同设计的浏览器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18914188/

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