English 中文(简体)
显示 2 divs 和内嵌的复选框吗?
原标题:Displaying 2 divs with checkboxes inline?

2 div s. HTML 和 CSS 仅。

在 CSS 中指定第二个 div 位于第一个 div 右侧。

第二个第(div)项的标题就在那里,预期的位置是复选框,但不是复选框。

Why aren t the second div s check boxes in the same area?
(They more under the first divs, to the left....?)

非常感谢任何帮助。

JsFiddle 中的代码: < a href="http://jsfiddle.net/GregMcNulty/2mQ7k/"rel="nofollow" >http://jsfiddle.net/GregMcNulty/2mQ7k/

<html>
    <head>
        <style type="text/css">
            #checkbox1
            {
                display:inline;
                position:relative;
                top:1in;
                left: .5in;                              
            }
            #checkbox2
            {
                display:inline;
                position:relative;
                top:1in;
                left: 1.5in;                
            }   
        </style>    
    </head>
<body>   

      <form>

        <div id="checkbox1">
            Please select the Clamps you are interested in:
        </div>

        <div id="checkbox2">
            Please select the Revets you are interested in: <br />
            <input type="checkbox" name="Solid" /> Solid <br />
            <input type="checkbox" name="Cherry" /> Cherry lock <br />
            <input type="checkbox" name="PopRivets" /> PopRivets <br />
            <input type="checkbox" name="Rivnuts" /> Rivnuts <br />
            <input type="checkbox" name="Huck" /> Huck Clinch
        </div>


    </form>

</body>
</html>
最佳回答

您有您的 divs < code> inline 我怀疑您实际想要的是 < code> inline block , 并且垂直对齐, 以便他们有想要的对齐 。

        #checkbox1
        {
            display:inline-block;
            vertical-align:top;
            position:relative;
            top:1in;
            left: .5in;                              
        }
        #checkbox2
        {
            display:inline-block;
            vertical-align:top;
            position:relative;
            top:1in;
            left: 1.5in;                
        }   

< a href=" "http://jsfiddle.net/stFLC/6/" rel = "no follow" >FIDDLE

问题回答

暂无回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签