As far as I am aware, a <form></form>
tag is supposed to be invisible as part of a webpage, and that when designing a form, one should use div tags (or equivalent) to represent the physical form structure.
Is it acceptable (according to W3C standards) to apply CSS to a <form></form>
tag? and can anyone point me in the right direction for literature on this issue?
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 form is just another element of the page (think of it as a div which can contain input/other elements). You can style it with CSS just like any other element - it's all completely valid. Save this answer.
CSS form is used to create interactive forms for users and provides many ways to set the style. There are many CSS properties available that can be used to create and style HTML forms to make them more interactive.
Right-click any element in the Google Form and choose Inspect Element . Next, switch to the Styles panel and experiment with different styles for colors, padding, font-size and any other CSS property. You can then copy the CSS and paste it into the custom CSS section.
As far as I am aware, a
<form></form>
tag is supposed to be invisible as part of a webpage
It is supposed to represent a form. That is definitely visible thing
and that when designing a form, one should use div tags (or equivalent) to represent the physical form structure.
<div>
is the tag of last resort. Use it when something more suitable (like <form>
or <fieldset>
) does not exist.
Is it acceptable (according to W3C standards) to apply CSS to a
<form></form>
tag?
Baring bugs in browsers, it is acceptable to style any element in the document.
and can anyone point me in the right direction for literature on this issue?
Since there is nothing special about the element, it does not need specific documentation.
The closest I can think of is this warning from the CSS 2.1 specification:
Note. CSS gives so much power to the "class" attribute, that authors could conceivably design their own "document language" based on elements with almost no associated presentation (such as DIV and SPAN in HTML) and assigning style information through the "class" attribute. Authors should avoid this practice since the structural elements of a document language often have recognized and accepted meanings and author-defined classes may not.
… but relating that to the question is a stretch since you are suggesting using semantic markup, but adding unnecessary divs purely for styling.
A form is just another element of the page (think of it as a div which can contain input/other elements). You can style it with CSS just like any other element - it's all completely valid.
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