输入标记中有多种字体颜色 [英] Multiple font colors in an Input tag
本文介绍了输入标记中有多种字体颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我很好奇Google的即时搜索功能如何在单个输入[type = text]
元素中维护两种不同的字体颜色。黑色用于用户输入,灰色用于建议。感谢
I'm curious as to how Google's instant search feature maintains two separate font colors within a single input[type=text]
element. Black for the user input and gray for the recommendations. Thanks
推荐答案
他们只是将另一个< div>
位置。启动Firebug,IE开发工具或其他,并查找< div>
与 id ='grey'
。
They simply overlay another <div>
at the same location. Fire up Firebug, IE Dev Tools or whatever and look for the <div>
with id='grey'
.
<div style="position: relative; background-image: none; background-attachment: scroll; background-repeat: repeat; background-position-x: 0%; background-position-y: 0%; background-color: transparent;">
<div class="lst" id="grey" style="padding-left: 7px; white-space: nowrap;">
Text - hello world
<div class="lst" id="misspell"/>
<div class="lst" style="left: -9000px; top: -900px; width: auto; overflow: hidden; position: absolute; max-width: 3000px;">
Text - hello w
<input name="q" title="Search" class="lst" type="text" maxLength="2048" autocomplete="off" init="true" value="hello w"/>
这篇关于输入标记中有多种字体颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文