我在一个包含INT字段中的增量编号的大型MySQL数据库中有一个INT字段.这些数字目前是常规自动增量数字(1,2,3),但我需要在开头用零填充它们为三位数(所以我得到001,002,003 ... 010,011等).
我可以在数据库上运行哪些命令将此列更改为我需要的格式?
我希望在每个单元格之间有一个填充表,但不是在外边缘单元格周围,也就是说,不在表格本身周围.
使用:
border-collapse : separate;
border-spacing : 0.5em;
Run Code Online (Sandbox Code Playgroud)
给我填充到处,同时使用:
border-collapse : collapse;
Run Code Online (Sandbox Code Playgroud)
在任何地方都没有填充.
尝试另一种方法,我可以得到填充单独之间的细胞水平使用td + td选择器.但是我不能使用tr + tr选择器,因为它似乎tr忽略了边距,填充和边界规则.
当然,普通td选择器上的填充适用于所有单元格,甚至是外部单元格的外边缘.
这只适用于当代浏览器 - 对我来说没有IE 6或7非常感谢你.而且我不会在IE 8上失去任何睡眠,尽管如果有效的话会很好.
我有一张桌子,像这样构造:
<table>
<tr> <td>1</td> <td>2</td> <td rowspan="4">3</td></tr>
<tr> <td>4</td> <td>5</td> </tr>
<tr> <td>6</td> <td>7</td> </tr>
<tr> <td>8</td> <td>9</td> </tr>
<tr height="100"><td colspan="2">10</td><td class="eleven">11</td> </tr>
</table>
Run Code Online (Sandbox Code Playgroud)
现在问题出在最后一行.整行的高度设置为100px,因此在TD中有足够的空间.在最后一个TD中,我想设置一个单独的填充,因此只有内容"11"从顶部填充:
.eleven {
padding-top:15px;
}
Run Code Online (Sandbox Code Playgroud)
设置这会导致问题 - 此行中的第一个TD也会获得填充顶部:10px; 为什么以及如何只填充第二个?
我有一个应用程序,要求我使用CSS将<html>和<body>标签的高度设置为100%,像这样(JSFiddle版本):
html, body {
display: block;
height: 100%;
margin: 0px;
padding: 0px;
width: 100%;
}
body {
background-color: #141414;
overflow-x: hidden;
overflow-y: auto;
}
Run Code Online (Sandbox Code Playgroud)
我已经包含了这些标签样式的所有CSS.但是,我总是有一个滚动条,允许我向下滚动约20px,无论页面的内容有多大或多小.这个问题在任何规模的碎片上都会持续存在.
我可以在这些截图中看到原因.请注意,正文的ID为#container,但这仅用于JS定位,而不是CSS样式:

同一页面的3D透视图,显示<body>标签从<html>标签顶部向下滑动:

由于我没有任何这些标签上的边距或填充,并且由于页面顶部附近没有任何HTML元素有任何边距或填充<body>向下推动标签,我真的卡住了.
如何修复CSS以使<body>标记与页面顶部齐平?
感谢您的时间.
我目前正在使用ScrollView中包含RelativeLayout的布局.
我希望RelativeLayout包含在距离ScrollView底部5dp的位置,因此它不会与我背后的背景重叠,为了实现这一点,我使用的是这样的XML:
<ScrollView
android:id="@+id/scrollView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/backgroundView1"
android:fadingEdge="none"
android:scrollbars="none"
android:paddingTop="5dp"
android:paddingBottom="5dp">
<RelativeLayout
android:id="@+id/innerLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</RelativeLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
这很好用,但我不再需要在顶部填充.删除paddingTop行时,paddingBottom不再起作用.即使我将paddingBottom设置为100dp,它也不会对我的布局产生影响.
我尝试了paddingTop ="0dp"并且也没有解决问题,看起来paddingBottom只有在paddingTop高于0时才能工作.
任何人都有任何想法,为什么paddingBottom没有paddingTop不起作用?
我的按钮看起来像横向的顶部图像:
截图http://i46.tinypic.com/33zb9dj.jpg
我希望它看起来像底部图像.
这是我的这些按钮的.xml代码.
<TableRow
android:id="@+id/tableRow7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:weightSum="1.0" >
<ImageButton
android:id="@+id/appHome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:background="@null"
android:contentDescription="Home"
android:cropToPadding="true"
android:scaleType="fitEnd"
android:src="@drawable/home_bar" />
<ImageButton
android:id="@+id/menuHome"
android:layout_weight="0"
android:background="@null"
android:contentDescription="Menu"
android:cropToPadding="true"
android:scaleType="center"
android:src="@drawable/menu_bar" />
<ImageButton
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:background="@null"
android:contentDescription="Back"
android:cropToPadding="true"
android:scaleType="fitStart"
android:src="@drawable/back_bar" />
</TableRow>
Run Code Online (Sandbox Code Playgroud) 我有这样的EditText定义:
<EditText
android:id="@+id/input_password"
android:hint="@string/password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPassword" />
Run Code Online (Sandbox Code Playgroud)
它有一些默认的填充,看起来像"Show layout bounds"选项:
(或者它真的是边缘,我不确定.我指的是红色内盒和蓝色角落之间的空间).但这些填充/边距的价值是多少?在platforms/android-19/data/res/values/themes.xml我发现的Widget.EditText样式定义如下:
<style name="Widget.EditText">
<item name="android:focusable">true</item>
<item name="android:focusableInTouchMode">true</item>
<item name="android:clickable">true</item>
<item name="android:background">?android:attr/editTextBackground</item>
<item name="android:textAppearance">?android:attr/textAppearanceMediumInverse</item>
<item name="android:textColor">?android:attr/editTextColor</item>
<item name="android:gravity">center_vertical</item>
</style>
Run Code Online (Sandbox Code Playgroud)
但是没有提到任何边距/填充.那他们在哪里定义?
在一些读数之后,我理解编译器已经对结构或类进行了填充,以便可以在其自然对齐的边界上访问每个成员.那么在什么情况下编码人员需要明确调整以获得更好的性能?我的问题来自于此:
英特尔64和IA-32 Architechtures参考手册:
For best performance, align data as follows:
Align 8-bit data at any address.
Align 16-bit data to be contained within an aligned 4-byte word.
Align 32-bit data so that its base address is a multiple of four.
Align 64-bit data so that its base address is a multiple of eight.
Align 80-bit data so that its base address is a multiple of sixteen.
Align 128-bit data so that its base address is a multiple of sixteen.
Run Code Online (Sandbox Code Playgroud)
所以假设我有一个结构: …
我在锚内的文字没有填充,但填充在它悬停时适用.这就是为什么悬停我的网络结构只是移动.请帮忙.
#include<stdio.h>
struct A
{
char c;
double e;
int s;
}A;
int main()
{
printf("%u\n", sizeof(A));
return 0;
}
Run Code Online (Sandbox Code Playgroud)
它给出了输出16.如果我们考虑结构内部填充和结构填充作为一个整体,它不应该是24?
我正在使用GCC 4.8.2在Ubuntu 14.04 32位上编译代码.