我有一种情况,我在页面上有两个或多个固定位置元素,显示堆叠的一个在另一个上面(也就是说,第二个的顶部邻接第一个的底部 - 没有z-索引堆叠这些元素).在第一个固定位置元素内部,有一个绝对定位的元素,它高于其固定的父元素,因此它延伸到固定父元素的底部之外.
问题是下一个固定位置元素显示在绝对定位元素的顶部.我在绝对定位的元素上设置了比固定定位元素更高的z-index值,但它被完全忽略.
为了帮助澄清这个问题,我把这个例子放在一起:
HTML
<div class="fixed first">
<p>This is a fixed element</p>
<p class="abs">
I should be displayed above both fixed position elements
</p>
</div>
<div class="fixed second">
<p>This is a fixed element</p>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS
.fixed {
font-size: 16px;
background: #eee;
border-bottom: 1px solid #ccc;
position: fixed;
height: 3em;
width: 100%;
z-index: 1;
}
.abs {
position: absolute;
background: #acc;
height: 6em;
top: 0;
left: 25%;
width: 50%;
z-index: 2;
}
.second {
top: 3.0625em;
}
Run Code Online (Sandbox Code Playgroud)
这是JSFiddle的工作示例:
我正在尝试在perl脚本中使用awk语句,该脚本接受用户输入并搜索许多文本文件以查找以任何顺序匹配输入中的所有单词的行.为此,我能够在CLI上进行我想要的Awk搜索:
awk 'tolower($0) ~ / 204/ && / test/ && / leg/' *_Codes.txt
Run Code Online (Sandbox Code Playgroud)
这将返回引用文本文件中的行,其中包括以"204","test"和"leg"开头的单词,例如"在2045房间中测试左腿";
但是,当我尝试在Perl脚本中执行此操作时,将用户输入设置为变量并将其修改为包含&&运算符和斜杠,我没有得到任何回报.这就是我所拥有的:
my ($code_search, $code_set) = @_;
# Clean the input for awk
# trim whitespace from the ends
$code_search =~ s!(^\s+|\s+$)!!g;
# separate words with the && operator and slashes
$code_search =~ s!\s+!/ && / !g;
# make input lower case and tack on front and back slashes
my $sanitized_query = lc "/ ${code_search}/";
# at this point, a user input of '204 leg …Run Code Online (Sandbox Code Playgroud)