Multiple font colors in an Input tag

后端 未结 1 480
感情败类
感情败类 2021-01-19 20:03

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 an

相关标签:
1条回答
  • 2021-01-19 20:09

    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"/>
    
    0 讨论(0)
提交回复
热议问题