在CSS中,保证金顺序是:右上角左下角
在XAML中,保证金顺序为:左上方左下方
有没有理由为什么WPF团队没有将这与CSS规范对齐?
当这套聪明的规则有所帮助时,无法弄清楚情况.它们打破了盒子模型的简单性,并在将不同的布局组合在一起时提供无限的麻烦来源.那是什么原因?
参考规则.
更新:规则对于兄弟元素是非常合乎逻辑的,但为什么边距应该传播到父元素直到树?解决了什么样的问题?
例如:
<div style="margin: 20px; background-color: red;">
<div style="margin: 20px;">
<p style="margin: 100px;">red</p>
</div>
</div>
<div style="margin: 20px; background-color: blue;">blue</div>
Run Code Online (Sandbox Code Playgroud)
顶级div相互间隔100px.
我有一个"容器" div我给了margin:auto;它只要我给它一个特定的工作正常width,但现在我改变它inline-block并且不margin:auto;工作
#container {
border: 1px solid black;
height: 500px;
width: 650px;
}
.MtopBig {
margin-top: 75px;
}
.center {
margin-left: auto;
margin-right: auto;
text-align: center;
}
Run Code Online (Sandbox Code Playgroud)
#container {
border: 1px solid black;
display: inline-block;
padding: 50px;
}
.MtopBig {
margin: 75px auto;
position: relative;
}
.center {
text-align: center;
}
Run Code Online (Sandbox Code Playgroud)

我想删除这两个元素之间的额外空间.我试过但不能这样做.这是保证金崩溃的问题吗?
怎么解决这个问题?如何删除多余的空间?
这是我的HTML:
<div id="output">
<i>
<span id="grade">Your grade :</span>
<span id="total"></span>
<span id="max"></span>
<center><h1><span id="percentage"></span></h1></center>
</i>
</div>
Run Code Online (Sandbox Code Playgroud)
这是我的css:
body
{
width:250px;
height:100px;
background : #F2F2F2;
}
#output
{
font-family : roboto light ;
color : #A4C639;
font-size : 30px;
}
#grade
{
font-size : 25px;
color : black;
}
#max
{
color : black;
}
#percentage
{
background : #A4C639;
color : #FFFFFF;
padding : 15px;
border-radius : 15px;
}
Run Code Online (Sandbox Code Playgroud) 默认情况下,"枚举"环境相对于当前环境缩进.如何禁用此缩进,以便三个项的枚举环境将生成与下面的代码相同的输出?
\documentclass{article}
\begin{document}
\paragraph{1.}
\paragraph{2.}
\paragraph{3.}
\end{document}
Run Code Online (Sandbox Code Playgroud) 这是位于网页上的两个跨度(在现实生活中很多跨度).我想设定他们之间的距离.我想使用margin-bottom属性,但我看不到使用它的任何影响.跨度仍然在前一个位置.那是错的.这是我的代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title></title>
<style type="text/css">
.position, .name{
overflow: hidden;
}
.position{
margin-bottom: 40px;
}
</style>
</head>
<body>
<span class="position">Designer</span><br/>
<span class="name">John Smith</span>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我想在我放在所有窗口上的所有控件上设置一个默认的3个边距,并且只能在很少的项目上覆盖这个值.
我已经看过一些像做风格的方法,但后来我需要设计一切,我更喜欢一些比所有控件都可以做到的事情.我已经看过像MarginSetter这样的其他东西,但看起来它不会遍历子面板.我只想在我放在窗口的控件上使用Margin,与视觉树的边框或其他东西无关.
看起来对我来说非常基本.有任何想法吗?
提前致谢.
当1em应用于元素时,它采用浏览器的默认值(通常为16px)或其父级的font-size值,对吗?但是我注意到如果我margin-top: 1em在h1元素中使用类似的东西(不使用重置样式表,因此,h1设置为font-size: 32px),则1em等于32px,即使其父元素设置为font-size: 16px.
但是,使用类似font-size的东西:100%; 解决了这个差异.
我错过了什么?
我想强调我的导航菜单,但问题是我需要它更厚,所以我使用底部边框,以便我可以将宽度设置为6px.
我似乎可以弄清楚如何使边框看起来更接近文本.目前文本和底部边界之间似乎有10px的差距,我不希望有任何差距.
我试图定位另一个div并将其相对于每个{li}与{bottom:10px}相对应,但我似乎无法让它工作.
这就是我所拥有的
码
<div id="menu">
<ul>
<li><a href="#home">home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS
#menu {
position: fixed;
left: 25%;
clear: both;
float: left;
font-size: 80px;
z-index: 500;
filter: alpha(opacity=75);
opacity: .75;
}
#menu ul{
text-decoration: none;
list-style-type: none;
margin: 0;
padding: 0;
line-height: 90px;
}
#menu ul li{
text-decoration: none;
list-style-type: none;
margin: 0;
}
#menu ul li a{
border-bottom: 6px solid #000;
text-decoration: none;
list-style-type: none;
color: #000;
}
#menu ul li a:hover{
}
Run Code Online (Sandbox Code Playgroud) 我在php中使用TCPDF创建pdf,我需要将我的数据包含到没有底边距的pdf中,数据将包含在页面的末尾.
$pdf->SetLeftMargin(14);
$pdf->SetTopMargin(6);
$pdf->SetFont($fontname, '', '9');
$pdf->setPrintHeader(false);
$pdf->SetFooterMargin(0);
$pdf->setPrintFooter(false);
$pdf->AddPage();
$pdf->writeHTML($html, true, 0, true, 0);
Run Code Online (Sandbox Code Playgroud)
我正在使用上面的代码.任何人都知道如何使用tcpdf从pdf中删除边距空间?