Put icon inside input element in a form

前端 未结 17 1790
旧时难觅i
旧时难觅i 2020-11-22 16:10

How do I put an icon inside a form\'s input element?

\"Screenshot

17条回答
  •  青春惊慌失措
    2020-11-22 16:19

    The site you linked uses a combination of CSS tricks to pull this off. First, it uses a background-image for the element. Then, in order to push the cursor over, it uses padding-left.

    In other words, they have these two CSS rules:

    background: url(images/comment-author.gif) no-repeat scroll 7px 7px;
    padding-left:30px;
    

提交回复
热议问题