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.
1) I use <h3></h3> headers for the headings of columns in a table. I notice Internet Explorer adds an extra blank line under the headings before continuing text but Mozilla does not. How do I eliminate the blank line following an <h3></h3> header? I would like text to follow immediately below the heading.
2) Same question for horizontal rules. I do not want a blank line below a horizontal rule; I would like text to follow it immediately. How do I get rid of this extra blank line?
First off, a quick word from our sponsor: you might well be interested in buying the greatly updated Creating Cool Web Sites with HTML, XHTML and CSS, which adds about 95% more CSS than the edition of the book you have, among other improvements!
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.
Dorothy Taylor
New interesting theme
Dorothy Taylor
New interesting theme
Good stuff, Jes. Thanks for the reminder of the remarkable flexibility of CSS, at least in some browsers. 🙂
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:
H3 {display:inline;}
simple as that.
For the question on form backgrounds:
the css is simply {background:#ffa} or whatever color you want.
Oh you want it to carry to more browsers?
I am not positive but try using a doctype declaration of xhtml strict.
I have seen this code work in netscape, firefox and IE6. forget IE5 and lower, whatever OS it is for. And I am not sure about safarai. If you stick to mozilla versions and IE you should get 95%+ of your visitors.
Aloha!
Hello, 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.
Duncan
online poker
Please check some relevant pages about online poker online casino phentermine
online poker
Please check some relevant pages about online poker online casino phentermine
I 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!
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.
Your suggestion would have me add this code to all eight column heads.
On the other hand, if I add this code to the document HEAD section, then ALL table cells are large and bold and I would have to somehow unbold the regular cells.
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.