这个问题已经困扰我一段时间了,我还没有找到解决方案并尝试了几种方法。我试图尽可能地保持我的标记语义。我已经搜索了类似的问题,但我无法将我的问题抽象到足以找到适用的解决方案。
我觉得对我的快速了解是为了解释我的设计方法。首先,我不是设计师。我没有受过正规培训,但设法找到了自己作为程序员的工作。我从 11 岁(1997 年)开始涉足网络工作,并在高中(2000-2004 年)深受网络标准运动的影响。直到几个月前,从那以后都没有考虑过网络工作。我工作的公司已经付钱给设计师在 Photoshop 中开发设计,并且准备付钱给另一个人来做 CSS 工作。这让我困惑不已,我决定站出来试一试,到目前为止一切都很好。
然而,我已经让一个棘手的问题溜走了。我们有一个设计为 3 列框的搜索表单。由于我工作的性质,我不得不将盒子抽象一下。该框在 webkit 中正确呈现,但中心列在 firefox、opera,尤其是 IE 中不会保持正确定位(未图示)。在这些浏览器的旧版本中看起来更糟。这可能是查看实时示例的好时机:http: //jsfiddle.net/KdFT7/
我应该简要解释一些标记。当单击“添加 X”按钮时,会出现一个模式窗口,其中包含选择 X 项目的选项,这将被附加到带有 XChoice 类的 div 中,并且选择的总数被附加到带有类的段落 (<p>) X选择如下。理想情况下,盒子从小开始并随着项目的添加而增长会很好,但这会给我带来如何更新中心列和 AddY 盒子的问题。总的来说,我对设计不满意,但我的工作是编写代码而不是批评它。
我需要一双新鲜的眼睛。我如何标记它,并应用正确的样式以使 3 列在大多数浏览器中齐平。我非常理解这一点,但我非常感谢任何解决这个问题的方法。标记可以更改,css 可以重新设计,但不幸的是,设计需要保持不变。
HTML
<div class="rightCol">
<div class="addX">
<h2><span class="tiny">Add</span>X</h2>
<span class="ui-corner-tl ui-widget-header ui-widget-borderfix"></span>
<div class="innerContent ui-padding-med ui-widget-content">
<form>
<input type="radio" id="radio-0" name="radio" checked="checked" /><label for="radio-0" class="ui-spacer-med">And</label>
<input type="radio" id="radio-1" name="radio" /><label for="radio-1" class="ui-spacer-med">Or</label><br />
</form>
<p class="descrip ui-spacer-med"> Click the button to lookup and select X for your search </p>
<div class="XChoice"></div>
<p class="xSelected"></p>
<!-- brings up modal form -->
<a href="addX.htm" class="addXButton">Add X</a> </div>
<span class="ui-corner-bl ui-widget-header ui-widget-borderfix"></span>
</div>
<div class="centerCol">
<span class="ui-widget-header ui-widget-borderfix"></span>
<form class="clause ui-widget-content ui-padding-med">
<input type="radio" id="radio-2" name="radio" checked="checked" /><label for="radio-2">And</label><br />
<input type="radio" id="radio-3" name="radio" /><label for="radio-3">Or</label><br />
<input type="radio" id="radio-4" name="radio" /><label for="radio-4">Not</label><br />
</form>
<span class="ui-widget-header ui-widget-borderfix"></span>
</div>
<div class="addY">
<h2><span class="tiny">Add</span>Y</h2>
<span class="ui-corner-tr ui-widget-header ui-widget-borderfix"></span>
<div class="innerContent ui-padding-med ui-widget-content">
<form>
<input type="radio" id="radio-5" name="radio" checked="checked" /><label for="radio-5" class="ui-spacer-med">And</label>
<input type="radio" id="radio-6" name="radio" /><label for="radio-6" class="ui-spacer-med">Or</label><br />
<input type="input" value="Enter Y(s)" /><br />
</form>
<a href="#" id="example">example</a>
<ol>
<li> We should find an example to put here?</li>
<li> Examples? </li>
<li> Yes, perhaps 3 solid examples </li>
</ol>
</div>
<span class="ui-corner-br ui-widget-header ui-widget-borderfix"></span>
</div>
<div class="addSubGroup ui-corner-all ui-widget-content">
<a class="rg ui-icon ui-icon-circle-minus" title="Remove Sub Group">Remove Sub Group</a> <a class="ag ui-icon ui-icon-circle-plus" title="Add Sub Group">Add Sub Group</a>
</div>
<span class="sub-clause">
<form class="ui-corner-all ui-widget-content">
<input type="radio" id="radio-7" name="radio" checked="checked" class="ui-spacer-med" /><label for="radio-7">And</label>
<input type="radio" id="radio-8" name="radio" class="ui-spacer-med" /><label for="radio-8">Or</label>
<input type="radio" id="radio-9" name="radio" class="ui-spacer-med" /><label for="radio-9">Not</label>
</form>
</span>
</div>
CSS
* { margin: 0; padding: 0; zoom: 0; }
body, html {font: .9em/1.1em HelveticaNeue, Helvetica, Arial, sans-serif;}
.addY,
.addX{ float: left; max-width: 370px; min-width: 218px; width: 43%; }
.addSubGroup { float: left; margin: -1em 0 0 80%; padding: .25em .5em; width: 2.5em; }
.ag,
.rg { float: left;}
.centerCol { float: left; margin-top: 3.05em; max-width: 66px; min-width: 46px; }
.clause { border-left: 1px solid #fff; border-right: 1px solid #fff; height: 210px; margin: 0 auto; }
#example { margin-left: 1em; }
#example+ol { display: none; line-height: 1.5em; margin-left: 2.5em; }
.rightCol { float: right; height: 350px; margin: -1em 1% 2%; width: 73%; }
.sub-clause { display: none; float: left; margin: 2% 0 1% 5%; text-align: center; width: 80%; }
.ui-widget-borderfix { display: inherit; height: 1.25em; }
h2 { color: #222; font: 2.2em/1em Georgia, serif; }
.rightCol h2 { margin: .5em 0 -.25em .45em; }
.innerContent { height: 210px; }
.ui-widget-content { background: #eee; color: #000000; }
.ui-widget { font-family: Arial,sans-serif; font-size: .8em; }
.ui-padding-med { padding: .5em; }
.tiny { font-size: .65em }
再次可以在这里找到一个活生生的例子:http: //jsfiddle.net/KdFT7/
PS。
奖励,这个问题与我问过的另一个没有得到可靠答案的问题有关: 克隆和更新属性