为什么我的保证金上限没有按应有的方式运行

Why is my margin-top not working the way it should be?

本文关键字:方式 运行 我的 保证金 为什么      更新时间:2023-09-26

我目前正在建立自己的网站,我在div及其利润率方面遇到了问题。如果我将googleDiv的页边空白设置为100%,则div会移动到页面的最终端,而不是其父div的端。

HTML:

<div id="scrollspy2">
        <div id="test"><img id="facebook" src="facebook.png" data-toggle="tooltip" data-placement="left" data-animation="true" title="facebook"></div>
        <div id="twitterDiv"><img id="twitter" src="twitter.png" data-toggle="tooltip" data-placement="right" title="twitter"></div>
        <div id="googleDiv"><img id="googleplus" src="google+.png" data-toggle="tooltip" data-placement="right" title="google+"></div>
    <div class="container" id="customContainer">
            <div class="row">
                <div class=" col-md-12 col-md-offset-3">
                    <header>
                            <h1 style="font-size:1050%;"><u>Hi!</u></h1>
                            <h1 style="font-size:300%;">*** <strong>***************</strong>.</h1>
                    </header>
                    <p style="font-size:150%;">******* <strong>**********</strong> *********************</p>
                    <p style="font-size:130%;">************************************************ </p>
                    <button id="button1" class="btn btn">**********</button>
                    <p id="or">or</p>
                    <form class="displayinline"action="Contactfile.html">
                            <button id="button2" class="btn btn">******* *****</button>
                    </form>
                </div>
            </div>
        </div>  
    </div>

JS:

$("#scrollspy2").css("height",$(window).height());

我不太确定你到底坚持了什么。据我所知,是div崩溃了。因此,它为什么要超出其父元素。

请使用谷歌Div ID导入此ID元素,在之间留出空间

#group:after{
    content: "";
    display: table;
    clear: both;
}

因此,将ID"group"放在div元素中GoogleDiv旁边,防止其折叠

边距很好,但需要一些时间来适应。你可以在各种测量中定义它们,比如px、%等。

这里的问题是,如果你有一个字体大小为1050%。这是屏幕高度和宽度的10.5倍。或者说和你的房子一样大。

边距是指在框外保留的空间,就像填充是为框内保留的一样。如果你在方框的一侧加上100%的边距,浏览器会尽力将方框推到屏幕的一侧或底部。因为100%是屏幕的总宽度或总高度。

如果您希望两个元素之间有一个小空间,请尝试使用20px而不是100%

https://getbootstrap.com/examples/grid/

https://getbootstrap.com/css/#grid

将这3个div放在自己的行中,col-md-12或col-md-4各放一行;甚至可能是一个容器。

否则,在你的3个特殊的<div class="clearfix"></div>之后可能会修复它。