Html 我如何将其向右移动?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5560975/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 07:48:39  来源:igfitidea点击:

how do I move this to the right?

html

提问by DiGiTAL_DOMAiN

How do i move this to the right ?

我如何将它向右移动?

<div class="contentcontainer med left">
            <div class="headings alt">
                <h2>Medium Width - Heading title here</h2>
            </div>
            <div class="contentbox">
                <form action="#">
                    <p>
                        <label for="textfield"><strong>Text field:</strong></label>
                        <input type="text" id="textfield" class="inputbox" /> <br />
                        <span class="smltxt">(This is an example of a small descriptive text for input)</span>
                    </p>
                    <p>
                        <label for="errorbox"><span class="red"><strong>Missing field:</strong></span></label>
                        <input type="text" id="errorbox" class="inputbox errorbox" /> <img src="img/icons/icon_missing.png" alt="Error" /> <br />
                        <span class="smltxt red">(This is some warning text for the above field)</span>
                    </p>
                    <p>
                        <label for="correctbox"><span class="green"><strong>Correct field:</strong></span></label>
                        <input type="text" id="correctbox" class="inputbox correctbox" /> <img src="img/icons/icon_approve.png" alt="Approve" />
                    </p>
                    <p>
                        <label for="smallbox"><strong>Small Text field:</strong></label>
                        <input type="text" id="smallbox" class="inputbox smallbox" />
                    </p>
                    <select>
                        <option>Dropdown Menu Example</option>
                    </select>  <br /> <br />

                    <input type="file" id="uploader" /> <img src="img/loading.gif" alt="Loading" /> Uploading...

                    <p> <br />
                        <input type="checkbox" name="checkboxexample"/> Checkbox
                    </p>
                    <p>
                        <input type="radio" name="radioexample" /> Radio select<br />
                    </p>

                </form>         
                <textarea class="text-input textarea" id="wysiwyg" name="textfield" rows="10" cols="75"></textarea>
                <p><br /><br />Buttons styles</p>
                <input type="submit" value="Submit" class="btn" /> <input type="submit" value="Submit (Alternative)" class="btnalt" />
            </div>
        </div>

回答by David Mason

Try setting the css 'margin-left' property of the outer div to push it away from the left side of the screen.

尝试设置外部 div 的 css 'margin-left' 属性以将其推离屏幕左侧。

<div class="contentcontainer med left" style="margin-left: 200px;">

(change 200 to an appropriate number).

(将 200 更改为适当的数字)。

Note: try not to use inline 'style' attribute in your final product - put it in an external stylesheet :)

注意:尽量不要在最终产品中使用内联“样式”属性 - 将其放在外部样式表中 :)

回答by Richard Schneider

if you want to move everything to right, use css "float: right".

如果您想将所有内容向右移动,请使用 css“float: right”。

For example:

例如:

<div class="contentcontainer med left" style="float: right">

回答by CoffeeMonster

You can offset by a set-amount with the CSS marginproperty:

您可以使用CSS 边距属性设置一定量的偏移量:

<div class="contentcontainer med left" style="margin-left: 50px;">