Re: limiting width of div (or other container) to width of text
by Gerhard Schoening <g.sch(at)onlinehome.de>
|
Date: |
Thu, 23 Jan 2003 08:02:50 +0100 |
To: |
Ann Ezzell <amcbainezzell(at)alum.mit.edu> |
Cc: |
hwg-style(at)hwg.org |
References: |
STARRYKNIGHT |
|
todo: View
Thread,
Original
|
|
Hi Ann,
On Thursday, January 23, 2003 at 07:11 you wrote:
> I want to put a border around the top, right, and bottom
> of the first H1 tag on a page, and have the border offset
> by some distance.
> Here's what I'm doing right now, and it doesn't work:
> In the HTML:
> <div id="headerBoxTraining"><h1>Header 1</h1></div>
> In the CSS:
> #headerBoxTraining {
> border-top: 2px solid #cccccc;
> border-bottom: 2px solid #cccccc;
> border-right: 2px solid #cccccc;
> padding: 10px 5px 10px 0px;
> margin-top: 10px;
> }
> #headerBoxTraining H1 {
> margin-top: 0px; /* because my normal H1 tag has a top margin */
> }
What you want is styling the H1, not the containing DIV. You
might try
In the HTML:
<div id="headerBoxTraining"><h1>Header 1</h1></div>
In the CSS:
#headerBoxTraining {
margin-top: 10px;
}
#headerBoxTraining H1 {
border-top: 2px solid #cccccc;
border-bottom: 2px solid #cccccc;
border-right: 2px solid #cccccc;
padding: 10px 5px 10px 0px;
margin-top: 0px; /* because my normal H1 tag has a top margin */
}
Regards,
Gerhard
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
Gerhard Schoening, Web Freelancer
Development of Bilingual Accessible Websites
http://www.schoening-online.com
Community & Portal Websites in PHP & MySQL
http://www.cp-web.com
HWG hwg-style mailing list archives,
maintained by Webmasters @ IWA