position 相关问题

位置是指元素相对于其容器的位置,通常在水平轴和垂直轴上。

粘性标题未堆叠在可滚动 Div 中的绝对容器顶部

我正在开发一个项目,其中页面顶部有一个绝对容器,可滚动容器内有多个粘性标题。然而,粘性标头并没有堆叠在......之上

回答 1 投票 0

粘性位置:标题在一段时间后滚动离开

在我的网站上,我已将 粘在顶部,但当我向下滚动时它只粘了几秒/像素,然后它就滚走了,请参阅下面的代码片段并滚动... 在我的网站上,我已将 <nav> 粘在顶部,但当我向下滚动时它只粘了几秒/像素,然后它就滚走了,请参阅下面的代码片段并向下滚动。我希望向下滚动时 nav 始终粘在顶部,除非 <header> 可见。 HTML <!DOCTYPE html> <html> <head> <title>Danis Website</title> <link href="reset.css" type="text/css" rel="stylesheet"> <link href="style.css" type="text/css" rel="stylesheet"> </head> <body> <div id="wrapper"> <header> <h1>Danis Website</h1> </header> <nav> <ul> <li><a href="index.html">Home</a></li> <li><a href="rezepte.html">Rezepte</a></li> <li><a href="zutaten.html">Zutaten</a></li> </ul> </nav> <main> Main Main Main<!-- In the code snippet below here are more lines of Text, here if have omitted the lines for better readability. </main> <footer> Footer </footer> </div> </body> </html> CSS *{ margin: 0; padding: 0; } body, html{ height: 100%; width: 90%; margin: 0 auto; background-color: #aaa; } #wrapper{ display: flex; flex-direction: column; height: 100%; background-color: fuchsia; } header{ flex: 0 0 50px; background-color: #888; text-align: center; position: sticky; top: 100px; } nav{ flex: 0 0 50px; background-color: dodgerblue; } nav ul { display: flex; list-style-type: none; background-color: dodgerblue; height: 100%; } nav ul li { flex: 1; text-align: center; padding: 10px; border-left: 2px solid #aaa; } nav ul li:first-child { border-left: 0; } nav ul li a{ color: white; text-decoration: none; } nav ul li:hover { background-color: #888; } main{ flex: 1; background-color: #ddd; } footer{ flex: 0 0 50px; background-color: #888; } #list{ display: flex; flex-wrap: wrap; } #list-item{ flex: 0 1 300px; display: flex; border: 1px solid dodgerblue; margin: 10px; padding: 10px; } #list-item-img{ flex: 0 0 auto; margin-right: 5px; } #list-item-text{ flex: 1; margin-left: 5px; } #list-item-text p { margin: 5px; } *{ margin: 0; padding: 0; } body, html{ height: 100%; width: 90%; margin: 0 auto; background-color: #aaa; } #wrapper{ display: flex; flex-direction: column; height: 100%; background-color: fuchsia; } header{ flex: 0 0 50px; background-color: #888; text-align: center; } nav{ flex: 0 0 50px; background-color: dodgerblue; position: sticky; top: 0px; } nav ul { display: flex; list-style-type: none; background-color: dodgerblue; height: 100%; } nav ul li { flex: 1; text-align: center; padding: 10px; border-left: 2px solid #aaa; } nav ul li:first-child { border-left: 0; } nav ul li a{ color: white; text-decoration: none; } nav ul li:hover { background-color: #888; } main{ flex: 1; background-color: #ddd; } footer{ flex: 0 0 50px; background-color: #888; } #list{ display: flex; flex-wrap: wrap; } #list-item{ flex: 0 1 300px; display: flex; border: 1px solid dodgerblue; margin: 10px; padding: 10px; } #list-item-img{ flex: 0 0 auto; margin-right: 5px; } #list-item-text{ flex: 1; margin-left: 5px; } #list-item-text p { margin: 5px; } <div id="wrapper"> <header> <h1>Danis Website</h1> </header> <nav> <ul> <li><a href="index.html">Home</a></li> <li><a href="rezepte.html">Rezepte</a></li> <li><a href="zutaten.html">Zutaten</a></li> </ul> </nav> <main> Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main Main </main> <footer> Footer </footer> </div> 编辑:我在 Arch Linux 上使用 Firefx 37.0.2 我相信这可能是因为你的height: 100%上有body。当您的内容太长时,body不会环绕整个内容,而只是继承浏览器视口高度。因此,当您滚动经过 body 的底部时,nav 就会停止粘住。 顺便说一句,虽然我认为你还不应该使用position: sticky。它的支持率不到浏览器的 20%。 http://caniuse.com/#feat=css-sticky 解决方案: 将 #wrapper 中的 height: 100%; 替换为 min-height: 100%;。刚刚删除 height: 100%; 时,页面小于内容未填充视口的页面上的视口 我这里也有同样的棘手问题。 正如DigitalDouble所说,是内容高度问题, 但不仅仅是身体造成的 我在我的 JavaScript 代码中找到了它...... 改变 $(contentElement).style.高度 = "99px"; 到 $(contentElement).style.minHeight = "99px"; 我希望它有帮助。 =) 只需显示我在哪里遇到此问题(运行代码片段以查看为什么会发生) html, body { /*it takes 100vh always */ height: 100%; border: 1px solid red; } .section { /*there was a problem, because it also set to 100vh */ height: 100%; /*remove it or change to fit-context*/ } .header { top: 0; position: sticky; background: green; } .main > div { height: 200vh; } <html> <body> <section class="section"> <header class="header">Header</header> <main class="main"> <div>Hello</div> </main> </section> </body> </html>

回答 3 投票 0

z-索引和堆叠;从堆栈上下文中删除子级

我正在尝试调整某些元素的堆叠顺序;这是一个 SSCCE。 鉴于这个 HTML 片段: Lorem ipsum dolor。 我正在尝试调整某些元素的堆叠顺序;这是一个SSCCE。 给出这个 HTML 片段: <div id="block1"> <div>Lorem ipsum dolor.</div> <div id="widget"> <div>Widgety goodness!</div> </div> </div> <div id="block2"> <div>Lorem ipsum dolor.</div> </div> <div id="block3"> <div>Lorem ipsum dolor.</div> </div> 我正在尝试在 #widget 之上显示 #block2;使用以下 CSS,您会发现在不更改 #widget 在节点树中的位置的情况下会出现问题。 #block1, #block2, #block3 { position: relative; min-height: 50px; width: 100%; } #block1, #block3 { background-color: #abc; color: #123; z-index: 1; } #block2 { background-color: #def; color: #456; z-index: 2; } #widget { background-color: #f00; position: absolute; z-index: 999; left: 200px; top: 40px; } 正如您在小提琴中看到的,#widget 与 #block2 部分重叠;这是非常有道理的,因为父级 #block1 在兄弟姐妹中的堆叠顺序较低。 显而易见的答案是:使#widget成为#block2的子级,但不幸的是这不是这里的解决方案。此外,无法修改 #blockN 元素的相对 z-index 值;块 1 和块 3 必须小于 2。(我的意思是计算值可能不同,但 #block2 将始终大于其兄弟姐妹)。这样做的原因是box-shadow分层。 是否有任何合理的(阅读:跨浏览器,IE7+)方法从其堆叠上下文中删除#widget,同时保留其位置,坐标位置,尺寸等? 使用 fixed 定位可以根据需要将其删除,但它也获得了被固定的所有视觉属性(这使其成为非解决方案) 我认为这可能已经以迂回的方式得到了回答,但我没有找到。另外,抱歉;看来我可能在我的第一篇文章中错过了一些无害但关键的细节。我想我现在已经涵盖了所有这些。 您的规则并没有真正应用于您希望它们应用的元素。您需要在要定位的元素上显式设置 z 索引,在您的情况下,该元素是 block2 的 div 子元素。通过简单地修改第一个选择器: #block1, #block2 , #block3 { 到 #block1, #block2 div, #block3 { 您的堆叠顺序已更正。您的 z-index 规则应用于父级,而子级继续使用默认的 auto。在您的情况下,通过设置 #block2 div 上的位置,您可以允许您的小部件位于 block2 子 div 的顶部。 jsFiddle 示例 我想你不需要改变#widget的位置。在我看来,答案就在于你的问题本身。 看看这个 编辑CSS: #block1{ background-color: #abc; color: #123; z-index:3; } #block3 { background-color: #abc; color: #123; z-index:1; } 一个可行的解决方案是使用 div 的 position 堆叠顺序,而不是在此处使用 z-index。因此不会形成不需要的堆叠上下文。 块 1 和 3 获取默认值 position: static 块 2 得到 position: relative(超过 1 和 2) 并且只有小部件才会获得 z 索引,这会将其移动到所有部件之上! http://jsfiddle.net/4eENM/

回答 3 投票 0

如何使用Azure对象锚点从检测到的对象中获取位置或锚点

我想使用 Azure 对象锚点获取锚点或检测到的对象的位置。 你能给我一些例子或者我可以使用的方法吗? 我尝试使用 Microsoft 示例来检测

回答 1 投票 0

Android:OnItemClickListener 错误的视图位置

我有一个带有自定义底座适配器的列表视图。我还设置了一个 OnItemClickListener,尽管它被调用,但视图的位置似乎不正确。 我想在

回答 1 投票 0

使用CSS视口高度和子绝对定位创建固定定位?

目标 我想绝对定位一个元素。 问题 奇怪的是,该元素在某种程度上看起来好像是位置:固定的。诡异的! html,正文{ 高度:100%; } .绝对{ ...

回答 2 投票 0

如何将一个元素放置在另一个元素下方?

我想将一个元素放在另一个元素下。我在CSS中使用position:absolute。 。第一的{ 宽度:70%; 高度:300px; 位置:绝对; 边框:1px 纯红色; } ....

回答 6 投票 0

删除文件名特定位置的字符

我的文件夹中有 100 个文件名(文本文件),如下所示 GCA_000696115.1_SoWt_ assembly_genomic.fna GCA_000985875.1_NgalHAMBI1146Draft_genomic.fna GCA_003990705.1_ASM399070v1_genomic.fna 对于文件...

回答 1 投票 0

jQuery UI 对话框位于触发对象上方时会闪烁

我正在尝试使用 jQuery UI 对话框来取代以前的 javascript 工具提示机制。我们的网站多年来一直使用 WZ_tooltips。 WZ_tooltips 由 Walter Zorn 于 2002 年创建。RIP

回答 1 投票 0

CSS 粘性定位在 <thead> 中不起作用的可能原因

我创建了一个模仿 C# 的 datagridview 的自定义元素。我能够像 dot net 的 listview 或 datagridview header 一样将 粘在顶部,直到最近我注意到它确实如此......

回答 1 投票 0

Unity Vuforia AR:交互后 3D 对象位置意外变化

大家好, 我正在与 Unity 和 Vuforia 合作开展一个增强现实项目。我使用了“地平面舞台”和“平面探测器”。我遇到的问题是...

回答 1 投票 0

使用 datatable() 时如何将 R markdown 中的表格定位在左侧

我正在使用 DT 包和函数 datatable() 使用 R markdown 在 HTML 输出中显示表格。我有一些表没有太多列,因此不会占用完整的...

回答 1 投票 0

XSLT:带条件的应用模板内的数字位置

我需要在调用模板时打印位置号,但是有条件。 IE。 “position()”不合适。 调用模板时需要打印位置号,但是有条件。 IE。 “position()”不合适。 <xsl:template match="property" mode="table-group"> <xsl:variable name="property_id" select="@id" /> <xsl:if test="/shop//shop_group[@id=$group]/property_value[property_id = $property_id]/value != 0 and /shop//shop_group[@id=$group]/property_value[property_id = $property_id]/value != '' "> <tr> <td> <b><xsl:value-of select="position()" /></b> <xsl:value-of disable-output-escaping="yes" select="name"/> </td> <xsl:apply-templates select="/shop//shop_group[@id=$group]/property_value[property_id = $property_id]" mode="table-group"/> </tr> </xsl:if> </xsl:template> 请帮忙。它打破了我的大脑...... 示例 xml: <shop> <shop_group> <property_value> <value>123</value> <name>NameA</name> </property_value> <property_value> <value>0</value> <name>NameB</name> </property_value> <property_value> <value></value> <name>NameC</name> </property_value> <property_value> <value>123</value> <name>NameD</name> </property_value> <property_value> <value>321</value> <name>NameE</name> </property_value> </shop_group> </shop> 我想要得到: <tr><td>1 NameA</td>...</tr> <tr><td>2 NameD</td>...</tr> <tr><td>3 NameE</td>...</tr> 但是如果使用“position()”我得到: <tr><td>1 NameA</td>...</tr> <tr><td>4 NameD</td>...</tr> <tr><td>5 NameE</td>...</tr> 将谓词移动到处理所选 xsl:apply-templates 元素的 property 指令: <xsl:apply-templates select="//property[value != '' and value != 0]"/> 在匹配的 xsl:template 规则中,position() 现在将具有正确的值。 (请注意,示例 XSLT 中的元素名称与示例 XML 中的名称不匹配,因此可能需要调整)。

回答 1 投票 0

改变对象的变换,使其父对象与其子对象相匹配

为此而疯狂。我正在尝试找出一种方法,以便当我抓取一个对象时,我可以设置该对象的旋转和位置,以便原始对象的旋转和位置

回答 1 投票 0

在CSS中获取鼠标指针的位置,无需Javascript

有没有办法只使用CSS来获取光标位置。我有一个框,我想根据用户最后一次单击来对齐。我没有自由使用 javascript 或 jquery 或任何其他框架。它...

回答 2 投票 0

我在 Windows 上使用 C++ 中的 SFML,当我放大或缩小时,它不会单击鼠标下方的单元格

这是一个生命游戏,所以有一个方格网格。我这样做了,我们可以通过单击单元格(左键单击)在网格上绘图。另外(通过视图)您可以通过右键单击从一侧移动到另一侧并放大...

回答 1 投票 0

带有CSS的图像位置

好吧,我正在用 html 和 css 做我的第一个页面,你看,你知道 operagx 和其他浏览器有正常尺寸的屏幕,当你按 f11 时是全屏,这里的问题是......

回答 1 投票 0

在设置新位图之前如何在平移和缩放后将图像视图重置为原始/干净状态

我尝试过 Stackoverflow 系统提供的许多类似问题,但它们适用于其他场景。我不使用画布,我使用矩阵来缩放和平移,但与滚动结合......

回答 1 投票 0

Kotlin中改变scaleX和scaleY后如何获取图像在imageview中的位置

我需要在比例改变后获取ImageView内图像的位置、宽度和高度。我需要这些值来添加代码来控制滚动限制。 我见过其他线程使用

回答 1 投票 0

合并两个单词列表不适用于位置功能

我一直在尝试通过将两个不同的单词列表混合在一起来获取字典,但是当我通过 Saxon 运行它时,它只在每一行重复 wordlist2 中的单词#1。看起来 Position() 保留了

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.