我使用指定页边距的样式文件。我无法理解样式文件,但我猜它通过使用诸如 \vspace、\vskip、\vfil 之类的命令来指定底部边距。
当我用 pdflatex 编译 tex 文档时,边距,尤其是底部边距,会发生变化。当我首先将文档编译为 ps 然后编译为 pdf 时,边距很好。
你有什么想法,可能是什么原因?
样式文件的内容可以从http://tinypaste.com/c53d1访问
使用负边距去除包装元素的填充是一个好习惯吗?
例如,以下哪个代码片段更适合使用?
<div style="padding: 5px;">
Shortened width string
<div style="margin: 0 -5px;">Full width string</div>
Shortened width string
</div>
Run Code Online (Sandbox Code Playgroud)
或者
<div>
<div style="padding: 5px;">Shortened width string</div>
<div>Full width string</div>
<div style="padding: 5px;">Shortened width string</div>
</div>
Run Code Online (Sandbox Code Playgroud) 我正在使用ckeditor,我的内容中有很多图片.我看到的一个问题是,您可以在图片周围添加水平或垂直空间,但不能只设置右图或左图水平图.通常如果我在页面的左侧有一张图片而右边的内容,我只想设置右边距(以避免图像在左边缩进)
从查看ckeditor演示,我只看到能够设置图片两侧的空间.不管怎么说,我不想做自定义css,因为我想为非技术用户提供这个功能吗?

我想弄清楚为什么有些字母(比如挪威语Å(Å))在顶部"o"的中间切出:

我的代码是这样的:
var titleFormat:TextFormat = new TextFormat();
titleFormat.size = textSize;
// this is embedded font, and exported for action script, declared
titleFormat.font = myFontBold.fontName;
titleFormat.bold = true;
titleFormat.color = parseInt("0x"+fontColor,16);
var titleText:TextField = new TextField();
titleText.defaultTextFormat = titleFormat;
titleText.embedFonts = true;
titleText.antiAliasType = AntiAliasType.ADVANCED;
titleText.text = "Å"+text;
addChild(titleText);
titleText.selectable = false;
titleText.wordWrap = true;
titleText.width = maskImg.width - 80;
// this should autosize to fit all text, but it doesn't the top of text
titleText.autoSize = TextFieldAutoSize.LEFT;
titleText.x = x; …Run Code Online (Sandbox Code Playgroud) 我在我的页面中使用jQuery动画添加了一些CSS属性,我不明白为什么margin: auto它不起作用.
HTML代码(由jQuery添加样式属性):
<body style="overflow: hidden;">
<div id="tuto_wamp" style="width: 7680px; height: 923px; ">
<!-- Step 1 -->
<div style="height: 549px; width: 1280px; margin-top: 0px; margin-left: 0px; position: absolute; overflow-y: hidden; overflow-x: hidden; ">
<div class="content_tuto">
<img src="images/install1.png" alt="">
</div>
</div>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
我的CSS代码:
#tuto_wamp
{
background: #3a393c;
width: 100%;
}
.content_tuto
{
width: 100%;
margin: auto;
display: block;
}
Run Code Online (Sandbox Code Playgroud)
我不知道哪个属性会阻止margin: auto图像居中.
谢谢.
这可能是由于边缘崩溃,我知道边缘折叠,至少它如何影响相邻元素,但我不明白当涉及负边距时它如何在嵌套元素上起作用.
例如,在此标记和随附的CSS中:
<div class="parent">
<div class="child">
Child 1
</div>
</div>
<div class="parent">
<div class="child negative">
Child 1
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
body {
background: white;
padding: 45px;
}
.parent {
border: 1px solid black;
margin-bottom: 10px;
}
.negative {
margin-bottom: -1px;
}
Run Code Online (Sandbox Code Playgroud)
这里有实例.
当我检查第二个.parentdiv 的高度时,我注意到它比第一个div小1个像素.发生这种情况是因为其.negative内部元素的负余量.我快速浏览了W3C,找不到这种行为的解释.
有人可以解释一下这里发生了什么,并为我提供了W3C规范部分的链接吗?
我有多个锚元素.偶尔点击它们什么都不做,所有CSS动画都可以工作,但链接没有打开任何页面/触发任何动作.我必须稍微移动光标然后再次单击.
我确定这是一个CSS问题,但我在CSS中找不到任何错误.我认为这个问题可能存在于边缘(4px底部边缘但是4px上边距:活跃)但我在很多网站上都看到了这个并且按钮工作得很好......
这是按钮.点击它们,大约20次点击中的一次不起作用(有时它会在第一次点击时发生):
http://jsfiddle.net/4nz4v/(注意按钮在点击后没有获得.active类,在最新的Opera和Chrome中测试过)
这是CSS:
.button {
display: inline-block;
vertical-align: top;
color: #000;
background: #aaa;
text-shadow: 1px 1px 1px #fff;
border: 0;
padding: 0.6em 1.2em;
margin: 0 0 4px 0;
text-decoration: none;
border-radius: 6px;
}
.button:hover {
color: #fff;
text-shadow: none;
}
.button:active {
margin: 4px 0 0 0;
}
.active {
background: #fff;
text-shadow: none;
color: #000;
}
Run Code Online (Sandbox Code Playgroud)
谢谢.
我有以下XML布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@layout/light_list_item_border"
android:orientation="vertical" >
<Button
android:id="@+id/light_list_item_lightdim_button"
android:layout_width="75dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@drawable/button_on"
android:text="@string/button_on"
android:textColor="@color/white"
android:layout_margin="5dp"
/>
<TextView
android:id="@+id/light_list_item_lightrgb_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/light_list_item_lightdim_button"
android:layout_alignBottom="@+id/light_list_item_lightdim_button"
android:layout_alignParentLeft="true"
android:text="@+id/label"
android:layout_marginLeft="5dp"
android:textColor="@color/white"
android:textSize="15sp" />
<TextView
android:id="@+id/light_list_item_lightrgb_labelSzene"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/light_list_item_lightdim_button"
android:layout_marginLeft="5dp"
android:text="@+id/label"
android:textColor="@color/white"
android:textSize="15sp" />
<Button
android:id="@+id/Button01"
android:layout_width="75dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_below="@+id/light_list_item_lightdim_button"
android:layout_marginBottom="5dp"
android:layout_marginRight="5dp"
android:background="@drawable/button_on"
android:text="@string/button_add"
android:textColor="@color/white" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
但对于任何情况:
android:layout_marginBottom="5dp"
Run Code Online (Sandbox Code Playgroud)
第二个按钮是'忽略'?
在这里你可以看到我的问题:标有"+"的按钮的底边应该有5的边距.
我也尝试android:paddingBottom过,但没有成功

谢谢
我正在尝试创建一个包含按钮的网格布局,但默认情况下这些按钮之间有一个空格,我不需要它..xml文件如下所示:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center">
<HorizontalScrollView android:id="@+id/HorizontalScrollView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gridLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
</GridLayout>
</HorizontalScrollView>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
我创建按钮并将其添加到网格布局的代码:
for (int rowCounter = 0; rowCounter < DIMENSION; rowCounter++)
for (int columnCounter = 0; columnCounter < DIMENSION; columnCounter++) {
Button b = new Button(this);
b.setText(" ");
GridLayout.LayoutParams params = new GridLayout.LayoutParams();
params.setMargins(0, 0, 0, 0);
b.setLayoutParams(params);
gridLayout.addView(b);
}
Run Code Online (Sandbox Code Playgroud)
这是一个看起来如何的图像:
我的标记很简单,我正在使用内联CSS.我的目标是margin: 0 auto;在styleHTML属性中使用图像居中.这是我尝试过的代码:
<div style="width: 100%;">
<img src="http://dummyimage.com/200x300/000000/fff" style="margin: 0 auto;"/>
</div>Run Code Online (Sandbox Code Playgroud)
为什么CSS不以我为中心<img>?