
Tweaking spacing in standard HTML
A reader writes:
Some time ago I purchased your book, Creating Cool HTML 4 Web Pages. I have gotten a lot of use out of it. However, I am now getting my feet wet on Cascading Style Sheets and have come across something I did not see answered in your book. I am hoping you can answer these two questions. On to your questions, though. First off, if you're adding table column heads, why not just use something like this: <td style='font-size:125%;font-weight:bold'>to accomplish the exact font treatment you seek without having to hassle with the h3 tag? Try it. Secondly, if you want to have a horizontal rule without a space following it, I'd try something like this: <div style='border-bottom:1px solid black;margin-bottom:0px'></div>(You might want a greater than zero pixel bottom margin in practice, though). Thanks for your query! Good luck with your new site.
Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Simpy.
Categorized:
HTML and CSS
(Article 3715)
Tagged: Previous: Getting the "adduser" script to work on Linux Next: You can sell ad space on your Web site! Subscribe!
Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader. Hello, Mr. Taylor. Thank-you for the posted reply. Hopefully, I will find time to write a review for your book as you requested. Regarding my first question (about controlling the spacing below table column heads), you suggest to use something like this: <td style='font-size:125%;font-weight:bold'> I may end up taking this approach, but what I would prefer is code I can put in the document HEAD section. My goal in taking the <h3> aproach is to have concise code whose behavior is controlled by specifications given in the document HEAD section. Once the code is working, I plan to move it to an external style sheet for accessing by several pages on my website. I am wondering (just a guess here), perhaps the line-height property is what I seek. Any other suggestions? Once again, thanks for your assistance. Posted by: David Binner at June 9, 2004 11:51 PMI may end up taking this approach, but what I would prefer is code I can put in the document HEAD section. Your suggestion would have me add this code to all eight column heads. Ah, then this is easier. In the head section have something like: .colhead { font-size:120%; text-align:center; font-weight: bold; } Then in the table, everywhere you'd use a that's really a column head, do this: <td class="colhead">content</td> Make sense? My goal in taking the <h3> aproach is to have concise code whose behavior is controlled by specifications given in the document HEAD section. Once the code is working, I plan to move it to an external style sheet for accessing by several pages on my website. Again, use a CSS class: .myh3 { font-size: 125%; font-weight: 900; margin-top: 10px; } And then use <div class="myh3">Header Text</div> Within the document. See if that solves your problems! Posted by: Dave Taylor at June 9, 2004 11:52 PMHello, Mr. Taylor. I would like to change the background color of the text input field of a standard HTML form. For example, consider the followng page, with a simple Quadratric Equation Solver: http://www.akiti.ca/Quad2Deg.html I am presently writing a similar calculator-type webpage. However, I would like to have the BACKGROUND colors of the RESULTS fields a color other than white (to indicate to the user that these fields are different than the other fields and he should NOT try to input data to these fields). So far, it seems that this feature is only available in certain browsers. Is this correct? Could you please let me know if I can do this, and if so, please let me know how to do it for ALL browwsers. Your help is appreciated.
Hi Dave and guests, To stop an 'h3' or any 'h' tag from causing a line break, simply put in the css part of your 'head' the following: simple as that. For the question on form backgrounds: Oh you want it to carry to more browsers? Aloha! Posted by: Jes at March 24, 2005 1:08 PMGood stuff, Jes. Thanks for the reminder of the remarkable flexibility of CSS, at least in some browsers. :-) Posted by: Dave Taylor at March 25, 2005 5:14 AMI have a lot to say, but ...
I do have a comment, now that you mention it!
|
![]()
Search
Find just the answers you seek from among our 1700+ free tech support articles by using our Lijit search engine.
Help!
Subscribe to
Ask Dave Taylor!
Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.
Articles and Reviews
Auctions and Online Shopping Blogs and RSS Feeds Building Web site traffic Business and Management Cell Phones and Mobile Phones CGI Scripts and Web Site Programming Computer and Internet Basics d) None of the Above HTML and CSS Mac OS X Help MySpace, Facebook, Twitter and Social Network Help Pay Per Click (PPC) Search Engine Optimization Shell Script Programming Sony PSP, MP3 Players, Etc. The Writing Business Unix and Linux Help Video Game Tips and Help Windows Help
Recent Entries
Join the List!
Book Links
|