使用CSS更改非常旧的网页上的下拉搜索结果的外观?

发布于 2025-02-10 20:23:40 字数 934 浏览 1 评论 0 原文

我发现了这个主题:将CSS应用于搜索的历史记录下拉

如果我正确理解了其评论(不是程序员,而只是一个小时代码调整器):使用CSS更改几乎是不可能的已经存在的下拉列表,该列表显示了输入框的先前搜索表达式?

我试图从1990年代重新设计网站,并且只能与CSS一起使用,而不是触摸HTML文件。原始代码是这样:

<form method="Post" action="/cgi-bin/-NAME-OF-THE-SITE-/the_search_form">

<hr>

<label for="search">Type text you would like to search for here: </label>
<input name="tquery" id="search" size="25" maxlength="60"> <p>

</p><center>
<input type="Submit" value="FIND"> <input type="Reset" value="CLEAR">
</center>

<hr>

</form>

我设法在视觉上返回提交 reset 按钮以及输入框本身 - 但是下拉列表在该框下方显示自身[我侦察]给定浏览器的默认视觉效果(因为它在Firefox中看起来与Opera不同],

我也想增加 Maxlengt 参数[即输入允许的符号数],但是我所能做的就是相反 - 限制它[以下(比原始 60 值]

I found this topic: Apply CSS to searched history drop down

If I understood its comments correctly [not being a programmer but just a small time code tweaker]: it is pretty much impossible to change with CSS an already existing drop down list that shows previous search expressions of an input box?

I am trying to rework a site from 1990s and can only work with CSS on it, not touching the HTML files. The original code is this:

<form method="Post" action="/cgi-bin/-NAME-OF-THE-SITE-/the_search_form">

<hr>

<label for="search">Type text you would like to search for here: </label>
<input name="tquery" id="search" size="25" maxlength="60"> <p>

</p><center>
<input type="Submit" value="FIND"> <input type="Reset" value="CLEAR">
</center>

<hr>

</form>

I have managed to rework visually the Submit and Reset buttons and also the input box itself - but the drop down list showing itself below that box has [I recon] the default visuals of a given browser [as it looks are different in Firefox than in Opera]

I would also like to increase the maxlengt parameter [i.e. the number of signs allowed for input], but all I could do was the opposite - limiting it [below than original 60 value]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笑看君怀她人 2025-02-17 20:23:40

当前,无法定型自动完成下拉菜单。

浏览器插入自动完成的下拉列表,无法设计。但是,人们已经找到了在其中创建自己的自定义下拉列表的方法,但这需要大量的JS和其他HTML元素。这是一个自定义自动完整搜索栏的示例:

因此,在您的特殊情况下,请不要担心!如果浏览器样式的自动完成方式不同,那么您就牢记了对用户的更好,因为它与他们习惯的相一致。另一种选择是完全关闭自动完成。

<input type="text" autocomplete="off">

但是再次,您说您只能触摸样式!

Currently, it is impossible to style autocomplete dropdowns.

The autocomplete dropdowns are inserted in by the browser and can not be styled. However, people have found ways around it be creating there own custom dropdowns but this requires a lot of JS and a few more HTML elements. Here is a example here of a custom autocomplete search bar: https://www.w3schools.com/howto/howto_js_autocomplete.asp

So in your particular case just don't worry about it! If the browser styles the autocomplete differently then you had in mind it will be better for the users because it's consistent with what they are used to. One more option is to just turn off autocomplete entirely like this.

<input type="text" autocomplete="off">

But again, you said you can only touch the styles!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文