2012-12-21 17 views
0

這是我發送到UIWebView實例的HTML格式文本。UIWebView中的HTML格式文本在格式化文本後顯示一個條形

"This is my sample 
<br> 
question text." And 
<br> 
<a style="padding:2px; font-family:'Futura-CondensedExtraBold',Georgia,Serif; color:white; border:0px solid;border-radius:10px; background-image: -webkit-linear-gradient(bottom, rgb(102,184,24) 4%, rgb(197,228,71) 52%); ">"The sample</a> 
<a style="padding:2px; font-family:'Futura-CondensedExtraBold',Georgia,Serif; color:white; border:0px solid;border-radius:10px; background-image: -webkit-linear-gradient(bottom, rgb(102,184,24) 4%, rgb(197,228,71) 52%); "> 
<br> 
<a style="padding:2px; font-family:'Futura-CondensedExtraBold',Georgia,Serif; color:white; border:0px solid;border-radius:10px; background-image: -webkit-linear-gradient(bottom, rgb(102,184,24) 4%, rgb(197,228,71) 52%); ">answer text goes</a> 
<a style="padding:2px; font-family:'Futura-CondensedExtraBold',Georgia,Serif; color:white; border:0px solid;border-radius:10px; background-image: -webkit-linear-gradient(bottom, rgb(102,184,24) 4%, rgb(197,228,71) 52%); "> 
<br> 
<a style="padding:2px; font-family:'Futura-CondensedExtraBold',Georgia,Serif; color:white; border:0px solid;border-radius:10px; background-image: -webkit-linear-gradient(bottom, rgb(102,184,24) 4%, rgb(197,228,71) 52%); ">here"</a>. 

這裏是UIWebView中輸出的圖像。

DEMO HERE

enter image description here

我seing下一個相同顏色的垂直條在網頁視圖每個格式化行。

我非常感謝這方面的任何提示/建議。謝謝。

+0

查看我的**更新**回答演示。 –

+0

爲了將來的參考,您將*很大程度上受益於在CSS文件中定義它。 – Makoto

回答

2

因爲你的代碼有2 <a>不包含任何文本,甚至它沒有</a>結束標籤(語法錯誤)。你已經給他們style="padding:2px"。因此它會在<a>標記內填充2px,並顯示背景顏色。

刪除那2 <a>,它會工作,你想要的。

Working Demo

+0

感謝您的快速輸入!我完全沒有看到,並且正在以編程方式創建文本。 –

+0

@KoolestM - 我的榮幸。所以你將需要檢查這個代碼正在生成。 :) –