Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 浏览器ctrl+;页面上的f find在静态标题后面显示结果_Javascript_Html_Css - Fatal编程技术网

Javascript 浏览器ctrl+;页面上的f find在静态标题后面显示结果

Javascript 浏览器ctrl+;页面上的f find在静态标题后面显示结果,javascript,html,css,Javascript,Html,Css,我已经创建了一个页面,它有一个标题,即使我滚动页面,它也会保持在原来的位置 问题是,当我通过按Ctrl+f键进行基于浏览器的单词查找,并尝试在我的网页上搜索某个内容时,搜索会在标题div后面进行。我必须向下滚动以查看搜索的作品(浏览器搜索的部分会突出显示) 我注意到gmail也有一个标题,它在页面的滚动条上保持不变,他们也处理这个“查找”问题 关于如何解决此问题的任何建议 下面提供我的页面的示例源: <html> <head> <style> #m

我已经创建了一个页面,它有一个标题,即使我滚动页面,它也会保持在原来的位置

问题是,当我通过按Ctrl+f键进行基于浏览器的单词查找,并尝试在我的网页上搜索某个内容时,搜索会在标题div后面进行。我必须向下滚动以查看搜索的作品(浏览器搜索的部分会突出显示)

我注意到gmail也有一个标题,它在页面的滚动条上保持不变,他们也处理这个“查找”问题

关于如何解决此问题的任何建议

下面提供我的页面的示例源:

    <html>

<head>
<style> 
#masthead {
    background-color: #131623;
    border-bottom: 4px solid #FFFFFF;
    border-top: 0 none;
    left: 0;
    min-width: 980px;
    position: fixed;
    top: 0;
    width: 100%;
}
#masthead {
    border-bottom: 0 none;
    border-top: 4px solid #171A23;
    left: 0;
    min-width: 980px;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 900;
}
#masthead {
    border-bottom: medium none;
    border-top: 0 none;
    box-shadow: none;
    overflow: visible;
    position: fixed;
}
#masthead {
    background-color: #131623;
    border-bottom: 4px solid #FFFFFF;
    border-top: 1px solid #666666;
    left: 0;
    min-width: 980px;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 900;
}

div, p, span, a, li, strong {
    font-family: Arial,sans-serif;
}

html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, li, fieldset, form, label, legend {
    border: 0 none;
    font-size: inherit;
    margin: 0;
    outline: 0 none;
    padding: 0;
    vertical-align: baseline;
}
</style>
</head>
<body>
<div id="masthead">
  <div id="universal-nav" style="height:40px; background-color:#eaeaea;" >

  </div>
  <div class="menu-subtabs" style="height:30px; background-color:#fafafa;"">
        <h2>SalesOne</h2>


  </div>
</div>
</br></br></br></br></br>
<table border="0" summary="Content Block">
    <tr>
        <td>
            <p xmlns="">
                <a href="#Win">Win Summary</a>
                <br/>
                <a href="#Client">Client</a>

                <br/>
                <a href="#Overview">Project Overview</a>
                <br/>
            </p>
            <p xmlns="" id="Win">
                <strong>
                    <font color="#008000">Win Summary</font>
                </strong>

            </p>
            <p xmlns="">
                Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.</p>


            <p xmlns="" id="Client">
                <font color="#008000">
                    <strong>Customer</strong>
                </font>
            </p>
            <p xmlns="">
                <a href="http://www.yara.com/">Yara International ASA</a>Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.
            </p>


            <p xmlns="" id="Overview">
                <strong>
                    <font color="#008000">Project Overview</font>
                </strong>
            </p>
            <p xmlns="">
                ITS Enterprise Services - security services will provide hosted and managed services as part of SO project for data center hosting and management. The security components include:</p>

        </td>

    </tr>
</table>
</body>
</html>
</html>

#桅顶{
背景色:#131623;
边框底部:4px实心#FFFFFF;
边界顶部:0无;
左:0;
最小宽度:980px;
位置:固定;
排名:0;
宽度:100%;
}
#桅顶{
边框底部:0无;
边框顶部:4px实心#171A23;
左:0;
最小宽度:980px;
位置:固定;
排名:0;
宽度:100%;
z指数:900;
}
#桅顶{
底边:中等无;
边界顶部:0无;
盒影:无;
溢出:可见;
位置:固定;
}
#桅顶{
背景色:#131623;
边框底部:4px实心#FFFFFF;
边框顶部:1px实心#666666;
左:0;
最小宽度:980px;
位置:固定;
排名:0;
宽度:100%;
z指数:900;
}
div,p,span,a,li,strong{
字体系列:Arial,无衬线;
}
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,缩写,地址,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,li,fieldset,form,label,legend{
边界:0无;
字体大小:继承;
保证金:0;
大纲:0无;
填充:0;
垂直对齐:基线;
}

通过描述它的方式,我想象您使用
position:fixed
z-index
或可能使用javascript将标题div覆盖在页面上

相反,请尝试以下操作:

<div class="header">this is the header</div>
<div class="content" style="overflow: scroll;">
  this is the content div, if the content becomes to large it will scroll
</div>
这是标题
这是content div,如果内容变大,它将滚动
overflow:scroll
属性将使div可滚动,而不是整个页面。这将使标题保持可见,而不会将内容放在标题后面


希望这有帮助

Gmail有一个带有溢出滚动条的div,所以他们从不在标题下隐藏任何内容。您也应该这样做,不使用“位置固定”,让内容部分尽可能大,而不超出窗口视口。试着这样做:

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
<style> 
#masthead {
    background-color: #131623;
    border-bottom: 4px solid #FFFFFF;
    border-top: 0 none;
    min-width: 980px;
    width: 100%;
}

div, p, span, a, li, strong {
    font-family: Arial,sans-serif;
}

html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, li, fieldset, form, label, legend {
    border: 0 none;
    font-size: inherit;
    margin: 0;
    outline: 0 none;
    padding: 0;
    vertical-align: baseline;
}

#content{
    overflow: scroll;
    overflow-x: hidden;
}
</style>

<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        var head = $('#masthead').height(),
        remaining_height = parseInt($(window).height() - head);
        $('#content').height(remaining_height);
    });
</script>
</head>
<body>
<div id="masthead">
  <div id="universal-nav" style="height:40px; background-color:#eaeaea;" >

  </div>
  <div class="menu-subtabs" style="height:30px; background-color:#fafafa;"">
        <h2>SalesOne</h2>


  </div>
</div>
    <div id="content">
<table border="0" summary="Content Block">
    <tr>
        <td>
            <p xmlns="">
                <a href="#Win">Win Summary</a>
                <br/>
                <a href="#Client">Client</a>

                <br/>
                <a href="#Overview">Project Overview</a>
                <br/>
            </p>
            <p xmlns="" id="Win">
                <strong>
                    <font color="#008000">Win Summary</font>
                </strong>

            </p>
            <p xmlns="">
                Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.</p>


            <p xmlns="" id="Client">
                <font color="#008000">
                    <strong>Customer</strong>
                </font>
            </p>
            <p xmlns="">
                <a href="http://www.yara.com/">Yara International ASA</a>Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.Located in Norway, Yara International ASA is the world&#153;s leading chemical company that converts energy, natural minerals and nitrogen from the air into essential products for farmers and industrial customers. Through their environmental and industrial products, they help safeguard air and water quality and preserve food quality.
            </p>


            <p xmlns="" id="Overview">
                <strong>
                    <font color="#008000">Project Overview</font>
                </strong>
            </p>
            <p xmlns="">
                ITS Enterprise Services - security services will provide hosted and managed services as part of SO project for data center hosting and management. The security components include:</p>

        </td>

    </tr>
</table>
        </div>
</body>
</html>

#桅顶{
背景色:#131623;
边框底部:4px实心#FFFFFF;
边界顶部:0无;
最小宽度:980px;
宽度:100%;
}
div,p,span,a,li,strong{
字体系列:Arial,无衬线;
}
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,缩写,地址,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,li,fieldset,form,label,legend{
边界:0无;
字体大小:继承;
保证金:0;
大纲:0无;
填充:0;
垂直对齐:基线;
}
#内容{
溢出:滚动;
溢出x:隐藏;
}
$(文档).ready(函数(){
var head=$(“#masthead”).height(),
剩余高度=parseInt($(窗口).height()-头部);
$('内容')。高度(剩余高度);
});

如果不使用建议的解决方法修改代码,就无法以您想要的方式解决此问题。这里的问题是:要直接修复它,您必须“了解”浏览器有关标记的信息,以便find bar了解固定的定位元素,并进行额外的滚动。但可用于查找工具栏的可访问API只有扩展,而不是html页面。 以下是一些来自和来自的文档,可能有助于阅读


此外,除了建议的标记修复之外,您还可以使用自己的findbarjavascript实现。或多或少的工作示例,并且在的编辑器中使用了类似的解决方法。因此,简而言之,您可以捕获Ctrl+F键点击,使用
stopPropagation()
preventDefault()
禁用浏览器默认行为,然后使用自己的实现。

我认为您需要做的就是在内容(表)中添加页边空白顶部,即:


#内容{
边缘顶部:80px;
}
#桅顶{
背景色:#131623;
边框底部:4px实心#FFFFFF;
边界顶部:0无;
左:0;
最小宽度:980px;
位置:固定;
排名:0;
宽度:100%;
}
#桅顶{
边框底部:0无;
边框顶部:4px实心#171A23;
左:0;
最小宽度:980px;
位置:固定;
排名:0;
宽度:100%;
z指数:900;
}
#桅顶{
底边:中等无;
边界顶部:0无;
盒影:无;
溢出:可见;
位置:固定;
}
#桅顶{
背景色:#131623;
边框底部:4px实心#FFFFFF;
边框顶部:1px实心#666666;
左:0;
最小宽度:980px;
位置:固定;
排名:0;
宽度:100%;
z指数:900;
}
div,p,span,a,li,strong{
字体系列:Arial,无衬线;
}
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,缩写,地址,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,li,fieldset,form,label,legend{
边界:0无;
字体大小:继承;
保证金:0;
大纲:0无;
填充:0;
垂直对齐:基线;
}

我认为你身上的边缘上衣应该能起作用。无论如何,在乔姆是这样的

<body style="margin-top: 80px;">
...

...

您可以添加屏幕截图吗?如果这是个问题,我认为这是该浏览器中的一个bug

浏览器必须修复
<body style="margin-top: 80px;">
...
$("#header").mouseover(function(){

    $("#header").css("opacity","1");
});

$("#header").mouseout(function(){

    $("#header").css("opacity","0.5");
});