2012-04-05 44 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