草庐IT

margin-bottom

全部标签

html - 为什么 margin 百分比会导致换行?

abc在上面的示例中,字母“c”将换行,但如果我将“margin-left”设置为px单位,“c”将与“a”和“b”在同一行。为什么会这样? 最佳答案 不幸的是,CSS2.1规范似乎对此没有明确的答案。事实上,我认为这完全属于未定义行为的范畴。以下是我能找到的相关要点:没有指定宽度的float将shrinktofittheircontents.对于仅包含内联内容的float内容,需要将float内容设置得足够宽以将其内容放在一行中(尽管有明确的换行符),仅此而已。计算利润率百分比basedonthewidthofthecontain

html - "top: 0; left: 0; bottom: 0; right: 0;"是什么意思?

我正在阅读此site中的指南关于居中元素的技术。我阅读了CSS代码,.Absolute-Center{margin:auto;position:absolute;top:0;left:0;bottom:0;right:0;}我也看了解释。但是我不明白的是解释“top:0;left:0;bottom:0;right:0;”的部分。它说,Settingtop:0;left:0;bottom:0;right:0;givesthebrowseranewboundingboxfortheblock.Atthispointtheblockwillfillallavailablespaceinits

html - 无法在 Safari 和 Chrome (WebKit) 中将 `margin` 添加到 `<legend>` 元素

编辑:截至2012年6月11日,此错误终于得到修复!https://bugs.webkit.org/show_bug.cgi?id=35981#c1我有一些非常简单的标记:MemberToolsUsernamePassword我试图在legend元素的底部添加一个小边距,这在Firefox2和3以及IE5-8中工作得很好,但是在Safari和Chrome中添加一个margin什么都不做。据我所知,legend只是另一个block级元素,Webkit向其添加margin应该没有问题,还是我不正确? 最佳答案 经过一些研究后,我找到了一

html - 对齐 self : flex-end not moving item to bottom

这个问题在这里已经有了答案:Aligndivelementtobottomofcontainer[duplicate](1个回答)InCSSFlexbox,whyarethereno"justify-items"and"justify-self"properties?(6个答案)Howdoesflex-wrapworkwithalign-self,align-itemsandalign-content?(2个答案)关闭5年前。如您所见:JSFiddle我希望作者div位于其父容器的底部。我尝试使用align-self:flex-end;但它不起作用。我做错了什么?.flexbox{di

html - margin-top 和 -webkit-margin-before 有什么区别

Webkit添加了自己的特定边距,它们是:-webkit-margin-before:-webkit-margin-after:-webkit-margin-start:-webkit-margin-end:我了解(margin-left和-webkit-margin-start)或(margin-right和-webkit-margin-end)与“从左到右”或“从右到左”语言相关的区别。我的问题是(margin-top和-webkit-margin-before)或(margin-bottom和-webkit-margin-after)之间有什么区别?注意:很明显-webkit前缀

html - 垂直对齐 : bottom not working

我认为vertical-align应该与行内元素一起使用。然而出于某种原因,灰色div中的所有内容都与顶部对齐,而不是底部。PageSize:50100200500*of> 最佳答案 这是一个使用Flex盒子的现代更新答案。div{height:100%;//containingdivmustfillthefullheightoftheparentdivdisplay:flex;align-items:flex-end;justify-content:flex-end;} 关于html-

css - 使用 margin/padding 将 <span> 与 <p> 的其余部分隔开

我有一段文本,我想用小斜体写下作者姓名和日期,所以我把它放在中。block并设置样式,但我想将名称隔开一点,所以我将边距(也尝试填充)应用到block,但它无法正常工作。我对这个问题做了一个jsfiddle-HEREhtml看起来像Loremipsumdolorsitamet,consecteturadipisicingelit.Ipsaomnisobcaecatidolorereprehenderitpraesentium.AuthorName,YearCSSp{font-size:24px;font-weight:300;-webkit-font-smoothing:subpixe

html - 嵌套 div 中的 margin-top

我对嵌套div中的margin-top有问题——当我将margin-top应用于嵌套div时,边距应用于父级div而不是嵌套的div。有什么想法吗? 最佳答案 我在父div中得到了overflow:auto的解决方案。 关于html-嵌套div中的margin-top,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/2890354/

html - Bootstrap 行类包含 margin-left 和 margin-right 这会产生问题

我正在使用Bootstrap'row'类将divs一个放在另一个之上,工作正常但是.row{margin-left:-15px;margin-right:-15px;}我注意到它指定margin-left和margin-right属性为-13px,因此我的内容向左移动。所以我所做的是添加另一个类如下:.row-no-margin{margin-left:0px;margin-right:0px;}这样就解决了目的,但是还是想知道'margin-left:-15px;'有没有什么具体原因。解决我的问题的最佳方法是什么。 最佳答案 .r

html - 为什么 "margin: auto"不使元素垂直居中?

正如您在下面的演示中看到的,margin:auto;将蓝色div水平居中,但不是垂直居中。为什么不呢?.box{border:1pxsolidred;width:100px;height:100px;}.center{background:blue;width:50px;height:50px;margin:auto;}我的问题不是寻求解决方法。 最佳答案 如前所述,此行为在section10.6.2中指定。CSS2.1,并且与CSS2保持不变.block盒按正常流向从上到下垂直堆叠。此外,verticalmarginsmaycol