I'd like to know if is possible to style a value of an input box... such as :
<input class="textBox" type="text" rel="Inserisci il <span style=" value="Inserisci il <span style='color:#c83243;'>titolo</span> per l’URL personalizzato" name="ctl00$InsertDati1$txtTitolo">
but it doesnt render the span element. Any suggestions?
Styling Input Fields If you only want to style a specific input type, you can use attribute selectors: input[type=text] - will only select text fields. input[type=password] - will only select password fields. input[type=number] - will only select number fields.
A style attribute on an <input> tag assigns a unique style to the input control. Its value is CSS that defines the appearance of the input element.
The value attribute specifies the value of an <input> element. The value attribute is used differently for different input types: For "button", "reset", and "submit" - it defines the text on the button. For "text", "password", and "hidden" - it defines the initial (default) value of the input field.
Using HTML tagStep 1: Firstly, we have to type the Html code in any text editor or open the existing Html file in the text editor in which we want to use the Html tag. Step 2: Now, move the cursor at the starting of that text whose color we want to change. And then, type the empty Html <font> tag at that position.
You can style the content within an input box. For eg:
input{
color:#ff0000;
font: 1em/1.25em Arial, Helvetica, sans-serif;
}
If you want to use placeholder content on the other hand, you can add a 'placeholder' attribute on the input tag like so:
<input type="text" class="textbox" placeholder='Title' />
Note that placeholders only work in browsers that support HTML5 and the placeholder attribute. If you want compatibility for older browsers and dont mind using some JQuery, you can use a JQuery plugin like JQuery Watermark.
You can't however, place span elements within the value
of an input
tag.
Using contentEditable attribute with div is very nice I think.
Example: https://jsfiddle.net/scjnwrnf/
<div contenteditable="true">This is a paragraph.<span style = "color:red"> It is editable. </span> Try to change this text.</div>
Then you can hide input element and put plain text value from div into input value via JavaScript.
Thanks penartur.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With