0

我有几个不同的问题。

我有一个 div,里面有几个其他的 div 和一些控件。我最大的问题是它在 Chrome 中的外观与在其他浏览器中的不同。就像现在一样,它看起来如下: 不同浏览器中的属性框

最大的问题是 Chrome,“宽度:”文本右侧的文本框向下移动到下一行。该框的代码可以在此 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 中关闭图像周围的“框边框”。这不是一个大问题,但如果有人知道是什么原因造成的,那就太好了。

4

1 回答 1

2

它是导致问题的浮动。你需要清除它们。

.propertiesControl {
    clear:both;
}

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

于 2013-09-20T10:22:59.010 回答