I have a simple HTML table with two columns containing text fields and headers for "Name", "Comments" and "Email".
I am looking for the best strategy for styling this HTML snippet, if it should appear on several pages - each page requires different sizes. I read a lot about CSS recently, but couldn't find enough information, but it's really convenient for me to know how best to create such a .css.
For example, I can show the comment form with a width of 50% on the comment page, but only 20% in the sidebar in some additional places on the site.
I'm mostly worried about how to style the width of the boxes, but of course the same approach applies for text. For example, the name field should not be as large as the email field. I think fixed widths are better than percentages.
There are many ways to stylize. Suppose I already have 1 master css file.
1) Put the percentage width in the tags input
, and then the outer div will be 100% width for any panel in which it is contained. This does not require special CSS pages, but I don’t like the idea of percent inside td
, plus I can’t easily change the height textarea
.
2) create styles for #Name, #Comments and #Email on each individual page as additional styles in <head><style>
*
3), #Name, #Comments #Email css . ? , , , , - , css .
4), #Name, #Comments #Email, , . , .faqPage #Name
, . , css.
5) 'emailField ,
nameField and
commentsField` [ 2,3,4 ]
6) 'shortField ,
fullWidthField and
textInputField` [ 2,3,4 ]
7) :)
8) -
. , ? , HTML (, , css - , , ).
<div id="pnlSubmitComments">
<table class="fieldTable">
<tr>
<td align="right">
<label for="Comments">Name:</label>
</td>
<td>
<input id="Name" name="Name" type="text" value="" />
</td>
</tr>
<tr>
<td align="right">
<label for="Comments">Email:</label>
</td>
<td>
<input id="Email" name="Email" type="text" value="" />
</td>
</tr>
<tr>
<td align="right" valign="top">
<label for="Comments">Questions:</label>
</td>
<td>
<textarea id="Comments" name="Comments">
</textarea>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input id="btnSubmitComments" name="btnSubmitComments" type="submit" value="Submit Questions" />
</td>
</tr>
</table>
</div>
- PS. ,
CommentsName
- Name
.