首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CSS Div Padding问题Internet Explorer

CSS Div Padding问题Internet Explorer
EN

Stack Overflow用户
提问于 2013-04-03 23:06:01
回答 1查看 1.2K关注 0票数 0

我正在尝试使用CSS来对齐表中的数字,当使用括号将数字显示为负值时。就像您在MS Word中使用小数点制表符一样。

CSS可以在IE6和更高版本中工作,但我的问题是在打印预览中的IE6 - IE9,或者当打印页面时,右括号填充变得大于指定值。它在Chrome和Firefox中的打印效果很好。

有人能给我指出解决这个问题的正确方向吗?

代码:

代码语言:javascript
复制
<html>
<head>
<title>Example</title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.8.1/build/cssreset/cssreset-min.css" />
<style type="text/css">
/* Ignore stuff below */
html{
    font-family: arial, tahoma, sans-serif;
    font-size: 12px;
    line-height: 1.25em;
    color: #333;
    -webkit-font-smoothing: antialiased;
    text-align: center;
    background: #eee;
}
.wrapper{
    width: 780px;
    margin: 10px auto;
    padding: 10px;
    background: #fff;
}
table{
    width: 100%;
    font-size: 24px;
    line-height: 1.25em;
}
h1{
    font-size: 18px;
    line-height: 1.25em;
    text-align: left;
    background: #eee;
    padding: 5px 10px;
}
/* Ignore stuff above */

.pR{
    padding-right: 10px; /* Needs to match width of .bracket below */
}
.bracket{
    width: 10px; /* Needs to match padding-right of .pR above */
    text-align: center;
    display: inline-block;
    /* Fix for inline-block for IE 7 */
    zoom: 1; 
    *display: inline;
}
.right{
    text-align: right;
}
</style>
</head>
<body>

<div class="wrapper">
<h1>With padding</h1>
<table>
<tr>
<td class="right pR">1</td>
</tr>
<tr>
<td class="right"><div class="bracket">(</div>1<div class="bracket">)</div></td>
</tr>
</table>
</div>
</body>
</html>
EN

回答 1

Stack Overflow用户

发布于 2013-04-05 13:36:03

不需要使用div。使用span元素代替div。

Div是创建问题的块元素。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15791091

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档