2012-04-05 45 views
1

我需要证明单行文本单行文本和我在过去有这个问题,用解决方案堆栈溢出网站帮助解决它对齐不工作

I can't justify single line text using CSS in asp.net

现在我需要做的一个类似的东西,这是行不通的,我已经把代码放在小提琴上,我甚至尝试过上述解决方案,这也不起作用。

可能是我做一些错误这是不noticible我。我的职业开发人员,但需要做的做设计工作,以及当前项目

提琴手链接http://jsfiddle.net/pp9hb/2/

这是使用Web表单& C#一个ASP.Net网站开发。

SOLUTION:下面CSS为我工作。现在在所有的浏览器文本两端

.Top10ArticleHeading 
{ 
    text-align:Justify; 
    font-size:11px; 
    font-family:Tahoma, Geneva, sans-serif; 
    height:16px; 
    color:black; 
    padding-top:2px; 
    text-decoration:none; 
    width:160px; 
} 
.Top10ArticleHeading:after 
{ 
    content: ""; 
    display: inline-block; 
    width: 100%; 
} 
+1

你想在你的例子中达到什么目的? – 2012-04-05 08:05:10

+0

@Clark:我错了我需要对齐单行文本......实际上是每个数字旁边的文本,如示例 – Learning 2012-04-05 08:18:05

+0

所示。说实话..应该是一个表格,而不是大量的div。 – Kyle 2012-04-05 08:23:10

回答

0

解决方案的更多信息:下面CSS为我工作。它现在是所有浏览器中的合法文本

.Top10ArticleHeading 
{ 
    text-align:Justify; 
    font-size:11px; 
    font-family:Tahoma, Geneva, sans-serif; 
    height:16px; 
    color:black; 
    padding-top:2px; 
    text-decoration:none; 
    width:160px; 
} 
.Top10ArticleHeading:after 
{ 
    content: ""; 
    display: inline-block; 
    width: 100%; 
} 
3

嗨,你这个定义CSS样式表像这样

的CSS P,H1 {文本对齐:理由; 文本排列倒数:证明;}

p:after, h1:after 
{content: "."; 
display: inline-block; 
width: 100%; 
height: 0; 
visibility: hidden;} 


h1 
{height: 1.1em; 
line-height: 1.1; 
background:green;} 

HTML

<h1>This is heading </h1> 


<p>hello demo texthello demo texthello demo texthello demo texthello demo texthello demo texthello demo texthello demo texthello demo texthello demo texthello demo texthello demo texthello demo texthello demo text</p> 

​ 

现在这个http://kristinlbradley.wordpress.com/2011/09/15/cross-browser-css-justify-last-line-paragraph-text/

+0

在所有浏览器中,我可能会遇到此问题 – Learning 2012-04-05 10:58:03