【问题标题】:h:graphicImage title - formatted texth:graphicImage 标题 - 格式化文本
【发布时间】:2014-02-13 09:08:20
【问题描述】:

我可以在 的标题中使用 html 属性吗?

我想要类似的东西:

<h:graphicImage value="/images/box.gif" title="#{literal}"/>

其中#{literal} 是一个字符串:&lt; b &gt; BoldText &lt; /b &gt;

title属性能否解释&lt; b&gt;标签?

【问题讨论】:

  • 如果我只想将字符串中的一个单词加粗怎么办?例如:#{literal}="这是一个粗体文本"

标签: html jsf jsf-2


【解决方案1】:

由于您被标记为 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/

希望这会有所帮助..!!

【讨论】:

    猜你喜欢
    • 2014-02-26
    • 2015-12-03
    • 2016-11-30
    • 1970-01-01
    • 1970-01-01
    • 2013-06-16
    • 1970-01-01
    • 2019-01-05
    • 2010-09-05
    相关资源
    最近更新 更多