I have a div called "divContainer" inside which i have few input elements like textboxes,radio buttons et.. How can i define the style for then in the CSS ? I wanna mention styles for elements inside this purticular div.not for the entire form.
Ex: For textboxes i need width as 150px; For Radio buttons i need width of 20px;
to add inputs inside the div. to select the div with querySelector . And then we call divElement. querySelectorAll with a selector string that selects input, select, checkbox, and textarea elements.
In HTML5, a <style> tag is allowed to appear under anything in <body> or <head> . Mostly you are not allowed to put blocking elements into inline elements but meta elements like style, script, meta may appear wherever you want.
The <div> tag defines a division or a section in an HTML document. The <div> tag is used as a container for HTML elements - which is then styled with CSS or manipulated with JavaScript. The <div> tag is easily styled by using the class or id attribute. Any sort of content can be put inside the <div> tag!
You can define style rules which only apply to specific elements inside your div
with id divContainer
like this:
#divContainer input { ... } #divContainer input[type="radio"] { ... } #divContainer input[type="text"] { ... } /* etc */
CSS 3
divContainer input[type="text"] { width:150px; }
CSS2 add a class "text" to the text inputs then in your css
.divContainer.text{ width:150px; }
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