我正在使用点燃格式KF8进行我的第一步.在发布准则,该格式支持CSS3状态:
早期的Kindle平台为层叠样式表(CSS)提供了非常基本的支持.这在KF8中得到了显着增强,支持CSS 2/CSS 3.
现在这似乎是"非常基本的":我想在表格单元格中对齐文本.比较Chrome与kindlegen 2.9/Kindle Previewer 2.94的输出.Kindle Preview完全忽略了对齐.
我究竟做错了什么?
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Table sample</title>
<meta charset="utf-8" />
<style>
td.right {
padding: 2px 4px;
text-align : right;
}
td.left {
padding: 2px 4px;
text-align : left;
}
td.center {
padding: 2px 4px;
text-align : center;
}
h2 { color: green; }
</style>
</head>
<body>
<a name="part2_chap1"/>
<article role="main">
<header class="chapter">
<hgroup>
<h2>ALIGNMENT</h2>
</hgroup>
</header>
<div class="epigraph">
<p class="noind">How to right align table data</p>
</div>
<section class="table" id="table01">
<table>
<tr>
<th>
<i>---center---</i>
</th>
<th>
<i>---right---</i>
</th>
<th>
<i>---right---</i>
</th>
<th>
<i>---left---</i>
</th>
</tr>
<tr>
<td class="center">---centered---</td>
<td class="right">right></td>
<td class="right">right></td>
<td class="left"><left</td>
</tr>
<tr>
<td class="center">centered</td>
<td class="right">right></td>
<td class="right">right></td>
<td class="left"><left</td>
</tr>
</table>
</section>
</article>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
当您必须以样式的名义进行此类解决方法时,这是令人沮丧的,但我建议将文本对齐应用于 中的包含元素td,例如
样式表片段:
td.right div {
width: 100%;
text-align: right;
}
Run Code Online (Sandbox Code Playgroud)
HTML 片段:
<tr>
<td class="right"><div>right></div></td>
</tr>
Run Code Online (Sandbox Code Playgroud)
希望这能满足您的需求,直到亚马逊整理好为止。