开发者

Change input element look

开发者 https://www.devze.com 2023-02-18 14:58 出处:网络
Is it pos开发者_如何学Gosible to make an input HTML element with a value make to look just like a text in a div using CSS? Make the border disappear and make the background color of the input same as

Is it pos开发者_如何学Gosible to make an input HTML element with a value make to look just like a text in a div using CSS? Make the border disappear and make the background color of the input same as the page backgound color.


If I understand correctly: yes.

See: http://jsfiddle.net/zaK7j/

Test CSS:

input, div {
    border: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    font: 13px sans-serif
}

HTML:

<input type="text" value="Yes." />
<div>Yes.</div>


input[type=text], textarea {background:none;border:0;padding:0;margin:0;}

Will reset your input and also your textarea.

Edit: Note that this works in IE7 and above.


You could use the CSS

input{
    border: none;
}


Your htlm like this i presume :

<div>
    <input type="text" value="some text"/>
</div>

And your css :

div {
    background-color: olive;
}
input[type=text] {
    border: none;
    background-color: olive;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消