-1

过去几天我一直有这个问题。我正在尝试将我的复选框移动到窗口窗格的右侧。但是,每当我使用 float:right 移动它们时,它们也会向下移动大约 20-30 像素,这意味着它们不再与标签正确对齐。

这是带有我希望全部对齐的标签/图像/复选框的窗格的代码:

<div id="leftPane" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region: 'left'">

            <div id="sealDiv" style="padding-top:0px;vertical-align:middle;"><a href="http://google.com"><img src="images/seal.png" alt="countySeal" style="width:150px;height:150px; "/></a></div>

            <h3 style="vertical-align:middle;"><u> Live Layers </u></h3>
            <div id="layerLabels">
            <img src="images/stateParkIcon.png" alt="stateParksIcon" style="height:20px; width:20px"/> <label>State Parks <input id="stateParks" class="lyrCB" data-dojo-type="dijit.form.CheckBox" onChange="stateChanged()"></label>
            <br/>
            <img src="images/countyParksIcon.png" alt="countyParksIcon" style="height:20px; width:20px;"/> <label>County Parks <input id="countyParks" class="lyrCB" data-dojo-type="dijit.form.CheckBox" onChange="countyChanged()"></label>
            <br/>
            <img src="images/countyOpenSpaceIcon.png" alt="countyOpenSpaceIcon" style="height:20px; width:20px"/> <label>County Open Spaces <input id="countyOpenSpace" class="lyrCB" data-dojo-type="dijit.form.CheckBox" onChange="countyOpenChanged()"></label>
            <br/>
            <img src="images/localParksIcon.png" alt="localParksIcon" style="height:20px; width:20px"/> <label>Local Parks <input id="localParks" class="lyrCB" data-dojo-type="dijit.form.CheckBox" onChange="localChanged()"></label>
            <br/>
            <img src="images/golfCourse.png" alt="imgGolf" style="height:20px; width:20px"/> <label>Golf Courses <input id="golfCourses" class="lyrCB" data-dojo-type="dijit.form.CheckBox" onChange="golfCoursesChanged()"></label>
            <br/>
            <img src="images/beach.png" alt="imgBeach" style="height:20px; width:20px"/> <label>Beaches <input id="beaches" class="lyrCB" data-dojo-type="dijit.form.CheckBox" onChange="beachesChanged()"></label>
            <br/>
            <img src="images/iceRink.png" alt="imgIce" style="height:20px; width:20px"/> <label>Ice Rinks <input id="iceRinks" class="lyrCB" data-dojo-type="dijit.form.CheckBox" onChange="iceRinksChanged()"></label>
            <br/>
            <img src="images/swimming.png" alt="imgSwim" style="height:20px; width:20px"/> <label>Indoor Pools <input id="indoorPools" class="lyrCB" data-dojo-type="dijit.form.CheckBox" onChange="indoorPoolsChanged()"></label>
            <br/>
            <img src="images/campgrounds.png" alt="imgCamp" style="height:20px; width:20px"/> <label>Campgrounds <input id="campgrounds" class="lyrCB" data-dojo-type="dijit.form.CheckBox" onChange="campgroundsChanged()"></label>
            <br/>
            <img src="images/boatLaunches.png" alt="imgBoat" style="height:20px; width:20px"/> <label>Boat Launches <input id="boatLaunches" class="lyrCB" data-dojo-type="dijit.form.CheckBox" onChange="boatLaunchesChanged()"></label>
            <br/>
            <img src="images/marinas.png" alt="imgMarinas" style="height:20px; width:20px"/> <label>Marinas <input id="marinas" class="lyrCB" data-dojo-type="dijit.form.CheckBox" onChange="marinasChanged()"></label>
            <br/>
            <img src="images/playgrounds.png" alt="imgPlaygronds" style="height:20px; width:20px"/> <label>Playgrounds <input id="playgrounds" class="lyrCB" data-dojo-type="dijit.form.CheckBox" onChange="playgroundsChanged()"></label>
            <br/>
            <img src="images/bikepath.png" alt="imgBike" style="height:20px; width:20px"/> <label>Bike Paths <input id="bikePaths" class="lyrCB" data-dojo-type="dijit.form.CheckBox" onChange="bikePathsChanged()"></label>
            <br/>
            <img src="images/boardwalksIcon.png" alt="boardwalkIcon" style="height:20px; width:20px"/> <label>Boardwalks <input id="boardwalks" class="lyrCB" data-dojo-type="dijit.form.CheckBox" onChange="boardwalksChanged()"></label>
            <br/>
            <img src="images/hikingIcon.png" alt="hikingIcon" style="height:20px; width:20px"/> <label>Hiking Trails <input id="hikingTrails" class="lyrCB" data-dojo-type="dijit.form.CheckBox" onChange="hikingTrailsChanged()"></label>
            <br/>
            <img src="images/crosswalksIcon.png" alt="crosswalksIcon" style="height:20px; width:20px"/> <label>Crosswalks <input id="crosswalks" class="lyrCB" data-dojo-type="dijit.form.CheckBox" onChange="crosswalksChanged()"></label>
            <br/>
            <img src="images/sidewalksIcon.png" alt="sidewalkIcon" style="height:20px; width:20px;"/> <label>Sidewalks <input id="sidewalks" class="lyrCB" data-dojo-type="dijit.form.CheckBox" onChange="sidewalksChanged()"></label>
            </div>
        </div>

是否有对此的“快速修复”,无论是 CSS 还是 Javasript,或者我是否以需要重做才能正常工作的方式创建了窗格?

谢谢!

4

1 回答 1

0

这里有一些选项,但本质上它被其他未浮动的元素推下。

  1. 也浮动其他元素。

  2. 将复选框首先放在 HTML 中(在图像和标签之前)。

  3. 请改用绝对定位。

于 2013-03-21T19:54:38.380 回答