nuzerog Posted September 9, 2009 Share Posted September 9, 2009 I have a search box embedded into a cell of a table. <td><form name="search" action="../search-post.asp" method="post"><br/><input type="text" name="searchString" size="25"/> <a href="java script:document.search.submit();"><font color=green face="arial,helvetica,verdana" size=2>Search</font></a></form></td>Is there a way to control the height of the cell with a form and make it as narrow as possible? Thanks MuchHKIM Link to comment Share on other sites More sharing options...
ShadowMage Posted September 9, 2009 Share Posted September 9, 2009 I have a search box embedded into a cell of a table. <td><form name="search" action="../search-post.asp" method="post"><br/><input type="text" name="searchString" size="25"/> <a href="java script:document.search.submit();"><font color=green face="arial,helvetica,verdana" size=2>Search</font></a></form></td>Is there a way to control the height of the cell with a form and make it as narrow as possible? Thanks MuchHKIMYes there is. You can use the style attribute of the input tag like this:<input type="text" name="searchString" size="25" style='height: 15px;'/> *EditSorry, that should be on the <td> tag: <td style='height: 15px;'/> But you will probably still have to change the input if you want the cell to shrink, because the cell will only go as small as the largest element in it. Link to comment Share on other sites More sharing options...
jeffman Posted September 9, 2009 Share Posted September 9, 2009 If you really want to do this right, you will modernize your code. Drop the <font> tag for one. You can put that information in a CSS sheet. This can be external or in the <head> section of your document. This page links to lots of examples: http://www.w3schools.com/css/css_reference.aspIt is also generally bad practice to put style attributes in content tags. That information can also come in your style sheet. (There is a place for style attributes, but some authors overuse them, making their pages very hard to maintain. One purpose of style sheets is to simplify.)And if you try really hard, you can find a way to do all of this without using a table at all. Since you're obviously not used to using CSS, that might be a goal for the future.Good luck. Link to comment Share on other sites More sharing options...
ShadowMage Posted September 9, 2009 Share Posted September 9, 2009 If there's only one object that needs to be changed though, isn't it a bit extreme to create a style in a style sheet for just that one, lonely tag?If there are a lot of tags that need a certain style then a style sheet is definitely the way to go. Link to comment Share on other sites More sharing options...
jeffman Posted September 9, 2009 Share Posted September 9, 2009 There is a place for style attributes, but some authors overuse them, making their pages very hard to maintain. One purpose of style sheets is to simplify. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.