Css 文本不是';t包装在UL LI A内
我有一个XSLT脚本来输出一个简单的垂直菜单,但是在我的几个链接上,文本没有包装,我不知道为什么 试图在链接中放置DIV,以及以包含文本,但没有效果 以前有人有过这种问题吗 XSLT: 您可以在此处查看结果:Css 文本不是';t包装在UL LI A内,css,umbraco,word-wrap,Css,Umbraco,Word Wrap,我有一个XSLT脚本来输出一个简单的垂直菜单,但是在我的几个链接上,文本没有包装,我不知道为什么 试图在链接中放置DIV,以及以包含文本,但没有效果 以前有人有过这种问题吗 XSLT: 您可以在此处查看结果: 问题在于左侧导航。您有空白:nowrap在您的#亚航ul li中,将由您的p继承 将其更改为空白:正常,或添加空白:正常应该可以解决您的问题。您应该提供输出HTML代码,而不是生成它的XSL源代码。顺便说一句,根据你的URL,左菜单中有P元素A元素,这是HTML5允许的,但在使用非HTML
问题在于左侧导航。您有
空白:nowrap代码>在您的#亚航ul li
中,将由您的p
继承
将其更改为空白:正常代码>,或添加空白:正常到p
或a
的code>应该可以解决您的问题。您应该提供输出HTML代码,而不是生成它的XSL源代码。顺便说一句,根据你的URL,左菜单中有P
元素A
元素,这是HTML5允许的,但在使用非HTML5解析器的旧浏览器中可能有问题。谢谢,Marat。我把p元素放在那里试图解决这个问题,这显然没有帮助。我将在下次提问时提供HTML:)XSLT中的空格处理会影响单词包装。使用显示:内联块;对于li和display:阻止锚来控制超链接的宽度。哦,我的天啊,不知道我怎么会错过这个!!非常感谢您:这是有史以来最好的解决方案!
<xsl:template match="/">
<xsl:variable name="items" select="$currentPage/ancestor-or-self::* [@isDoc and @level = 2]/* [@isDoc and string(umbracoNaviHide) != '1']"/>
<!-- The fun starts here -->
<div id="subnavtitle">
<xsl:value-of select="$currentPage/@nodeName" />
</div>
<xsl:if test="count($items) > 0">
<ul>
<xsl:for-each select="$items">
<li>
<xsl:if test="@id = $currentPage/@id">
<xsl:attribute name="class">current</xsl:attribute>
</xsl:if>
<xsl:if test="@id = $currentPage/../@id">
<xsl:attribute name="class">current</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(@id)}" >
<p style="width: 100px;">
<xsl:value-of select="translate(@nodeName,' ',' ')"/>
</p>
</a>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:template>
#subNavigation {
padding-top: 10px;
padding-right: 10px;
padding-left: 10px;
font-weight: bold;
font-size: 12px;
background-size: 100% auto;
margin: 0px;
}
#subNavigation ul {
margin: 0;
padding: 0;
border: 0;
outline: 0;
}
#subNavigation ul:after {
content: ".";
display: block;
font-size: 0;
height: 0;
clear: both;
visibility: hidden;
}
* html #subNavigation ul {
zoom: 1;
}
*:first-child + html #subNavigation ul {
zoom: 1;
}
#subNavigation ul li {
list-style-image: none;
list-style-type: none;
margin-left: 0px;
white-space: nowrap;
display: inline;
float: left;
background: url(Designit_Green/images/nav.png) repeat-x;
margin-bottom: 10px;
width: 150px;
}
#subNavigation li.current {
background: #FFF url(Designit_Green/images/nav-item-activeXXX.png) left top repeat-x;
}
#subNavigation li.current a:hover {
background: #FFF url(Designit_Green/images/nav-item-activeXXX.png) left top repeat-x;
}
#subNavigation li.current a {
color: #333;
}
#subNavigation li:last-child {
border: none;
}
#subNavigation a:link, #subNavigation a:visited {
padding-left: 15px;
padding-right: 0px;
padding-top: 10px;
padding-bottom: 10px;
color: #FFF;
display: block;
text-decoration: none;
}