1
我可以在< h:graphicImage>標題內使用html屬性嗎?h:graphicImage標題 - 格式化文本
我想是這樣的:
<h:graphicImage value="/images/box.gif" title="#{literal}"/>
其中#{literal}
是一個String:<b> BoldText </b>
標題屬性可以解釋< b>
標籤?
我可以在< h:graphicImage>標題內使用html屬性嗎?h:graphicImage標題 - 格式化文本
我想是這樣的:
<h:graphicImage value="/images/box.gif" title="#{literal}"/>
其中#{literal}
是一個String:<b> BoldText </b>
標題屬性可以解釋< b>
標籤?
既然你被標記爲html,我在HTML + CSS
回答你。你可以通過使用CSS設置屬性的一些樣式來完成。
HTML代碼:
<a href="#" title="This is link">Hi., Buddy.!!</a>
CSS代碼:
a {
color: #900;
text-decoration: none;
}
a:hover {
color: red;
position: relative;
}
a[title]:hover:after {
content: attr(title);
padding: 4px 8px;
color: #333;
position: absolute;
left: 0;
top: 100%;
white-space: nowrap;
font-weight: bold;
border-radius: 5px;
box-shadow: 0px 0px 4px #222;
background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #eeeeee),color-stop(1, #cccccc));
background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc);
background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
background-image: -ms-linear-gradient(top, #eeeeee, #cccccc);
background-image: -o-linear-gradient(top, #eeeeee, #cccccc);
}
演示中的jsfiddle:http://jsfiddle.net/f29uq/
希望這有助於.. !!
如果我只想讓字符串中的一個單詞變成粗體,該怎麼辦? ex:#{literal} =「這是一個bold text」 –