Ctrl F/Find feature in Chrome and IE modifies layo

2019-08-08 02:56发布

问题:

In the current minimal example (http://jsfiddle.net/twPHW/) :

<div style="overflow: hidden; height: 24px;">

<table>
<thead>
<tr>
<td style="background-color: rgb(109,173,157);">foo</td>
</tr>
</thead>
<tbody>
<tr>
<td style="background-color: rgb(236,222,117);">bar</td>
</tr>
</tbody></table>

</div>

The "foo" cell is the only one visible. Then if I do Ctrl-F (find feature in browser), and start typing "bar", the table inside the div will goes up (its top changes) to show to the user the matched element.

I know it could be a feature, but to me it appears to be a bug because it modifies the layout of the web page (clearing the search does not rollback previous top element).

This bug occurs in Chrome and IE9 but not in Firefox.

Any workaround that could fix the issue ?

PS: this seems to be related Browser ctrl+f find on the page shows result behind the static header but does not answer my question

回答1:

Overflow content is still searchable. If you don't want it shown, use display:none