最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Multiple font colors in an Input tag - Stack Overflow

programmeradmin2浏览0评论

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 remendations. Thanks

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 remendations. Thanks

Share Improve this question edited Nov 13, 2010 at 1:34 Yi Jiang 50.2k16 gold badges139 silver badges136 bronze badges asked Nov 13, 2010 at 1:13 b_db_d 7872 gold badges7 silver badges18 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

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" autoplete="off" init="true" value="hello w"/>
发布评论

评论列表(0)

  1. 暂无评论