拥有以下HTML
<!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">
<body>
<div style="width:400px;height:200px;background-color:Gray;margin-bottom:10px;"></div>
<div style="width:400px;height:200px;background-color:Green;margin-top:10px;"></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这两个DIV之间的空间只有10个像素.
为什么?请解释.
通过代码边距,我指的是指导特定代码行多长时间的行.不同的IDE对于这个设备有不同的语言,我相信Visual Studio称它们为"排水沟".
话虽如此,长度代码边距是否有一个特定的标准?我的IDE(Netbeans)默认有80个,但我想知道是否有任何押韵或默认的原因.
我正在开发这个博客,似乎ie7和ie8都显示内容,以便容器似乎忽略了"margin:0px auto;" 规则.
它可能是我没有得到的其他东西,但无论哪种方式,效果是内容(以及导航链接)由于某种原因浮动到左侧.
奇怪的是a)它在Firefox或Safari中根本没有出现 - 好吧,真的很奇怪吗?和b)它不是孤立的ie7,似乎ie8也是这样做的.
我没有任何原因 - 任何想法?
谢谢!!
wordpress containers margins internet-explorer-8 internet-explorer-7
我一直在运行一些测试,以找出为什么有些CSS边缘会崩溃以及为什么有些没有.我有以下测试代码:
<div id="seconddiv" style="margin-top:10px; margin-bottom:10px;">
<p style="height:200px; margin-top:5px; margin-bottom:5px;">This is the first paragraph in the second div!This paragraph is 200px tall.</p>
<p style="height:300px; margin-top:5px; margin-bottom:5px;">This is the second paragraph in the second div!This paragraph is 300 px tall.</p>
<p style="height:400px; margin-top:5px; margin-bottom:5px;">This is the third paragraph in the second div!This paragraph is 400px tall.</p>
</div>
Run Code Online (Sandbox Code Playgroud)
我试图准确地获得div的高度,但scrollHeight返回"910px".这是为什么?我期望"900px"作为scrollHeight,因为它不包括边距.
一些<p>边缘是否崩溃并计入高度?为什么有些人而不是其他人 我尝试了许多不同的边距高度组合,没有任何数据显示正在发生的事情.
当我使用Fancybox 2 jquery插件时,会添加23px的右边距(滚动条的宽度).
这是网站(点击"网站地图"按钮):http: //kevinlouisdesign.com/projects/Canu/web/
我不喜欢的是,当fancybox出现时,它会使内容跳转到左侧.我想摆脱这种边缘权利的风格.
我正在使用nvd3.js库及其水平图http://nvd3.org/ghpages/multiBarHorizontal.html 我试图通过以下css在栏之间添加一些边距但是不起作用. http://jsfiddle.net/petran/x7Cdz/1/
rect {
display: inline-block;
margin-top: 25px;
margin-bottom: 5px;}
Run Code Online (Sandbox Code Playgroud)
还有另一种方法可以实现吗?
让下表:
x <- sample(1:2, 100, replace = T)
tabela <- table(x)
Run Code Online (Sandbox Code Playgroud)
我添加了边距
> addmargins(tabela)
x
1 2 Sum
51 49 100
Run Code Online (Sandbox Code Playgroud)
但是,我想将"Sum"标签更改为"Total".我该怎么做呢?
我目前的解决方法是运行addmargins以获取函数的源代码,将其复制到我的脚本并将字符串更改"Sum"为"Total",但我想有一种更聪明的方法来实现这一点.
我需要在对话框周围添加自定义边距。任何建议如何做到这一点?(对话框位置顶部:100 像素,左侧 50 像素等)
使用Apache poi创建基本的word文档,我需要更改页边距.这个问题的答案似乎很完美,但我没有CTPageMar类.我正在使用3.10.任何人都有不同版本或不同方法的运气吗?
我试图绘制一个水平堆积条形图,但在顶部和底部获得令人讨厌的大边距。我想摆脱它或控制大小。
这是一个示例代码和图:
from random import random
Y = ['A', 'B', 'C', 'D', 'E','F','G','H','I','J', 'K']
y_pos = np.arange(len(Y))
data = [(r, 1-r) for r in [random() for i in range(len(Y))]]
print data
a,b = zip(*data)
fig = plt.figure(figsize=(8,16))
ax = fig.add_subplot(111)
ax.barh(y_pos, a,color='b',align='center')
ax.barh(y_pos, b,left=a,color='r',align='center')
ax.set_yticks(y_pos)
ax.set_yticklabels(Y, size=16)
ax.set_xlabel('X label', size=20)
plt.xlim(0,1) #removing the extra x on the right side
Run Code Online (Sandbox Code Playgroud)
如果要重新创建确切的数字,请对创建附加数字(“数据”)的序列进行采样:
[(0.2180251581652276,0.7819748418347724),(0.20639063565084814,0.7936093643491519),(0.5402540115461549,0.45974598845384507),(0.39283183355790896,0.607168166442091),(0.5082547993681953,0.4917452006318047),(0.02489004061858613,0.9751099593814139),(0.25902114354397665,0.7409788564560233),(0.12032683729286475,0.8796731627071352),( 0.41578415717252204, 0.584215842827478), (0.5860546624151288, 0.4139453375848712), (0.20982525842827478), (0.20982523737740)4052373774040

我希望在“K”顶部以及 x 轴和“A”之间有一个更小的间隙。如果我将 16 更改为:
fig = plt.figure(figsize=(8,16))
Run Code Online (Sandbox Code Playgroud)
到 10 一切都在缩小,但利润率仍然比较大。
有任何想法吗?谢谢!
margins ×10
css ×2
android ×1
apache-poi ×1
coding-style ×1
containers ×1
fancybox-2 ×1
formatting ×1
function ×1
html ×1
java ×1
jquery ×1
matplotlib ×1
ms-word ×1
nvd3.js ×1
python ×1
r ×1
rect ×1
svg ×1
totals ×1
wordpress ×1