I have an app using bootstrap.css for the design. I have a readonly input which looks like disabled because of bootstrap (cursor not allowed, background color grey etc...). I would like the input to look enabled with readonly activated.
How can I do that?
edit (adding more code):
Header:
doctype html
html(ng-app='myApp')
head
title=title
link(rel='stylesheet' href='stylesheets/bootstrap.min-3.1.1.css')
link(rel='stylesheet' href='stylesheets/style.css')
My input: input.form-control(readonly, placeholder='jj-mm-aaaa')
My stylus (style.css):
input[readonly]
background-color: #fff
Pure CSS Form Read-Only Inputs Class: There is no class for that we have a predefined attribute that can make any input field read-only and that attribute is readonly=” ” with empty value.
The :read-only selector selects elements which are "readonly". Form elements with a "readonly" attribute are defined as "readonly".
css cannot be used for making an input readonly. You can use jquery or simple javascript to change the prperty of the fields.
If you want to have <input readonly> elements in your form styled as plain text, use the .form-control-plaintext class to remove the default form field styling and preserve the correct margin and padding.
Assuming your custom css is included after the boostrap.css, place the following code in your custom css file
input[readonly] {
background-color: #fff;
/* any other styles */
}
If you only want to apply this style to specific read only inputs, add a class "exampleclass" to those inputs, and then use:
input[readonly].exampleclass {
background-color: #fff;
}
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