|
How do I tuck my corporate motto under my site name in CSS?I'm trying to get my company motto tucked right under my site URL in my header using CSS and can't quite get it right. I tried <h4> </h4> instead of <p></p>. Motto is showing up above domain name, still having trouble getting motto under domain name. Here's my code: <div id="header">
<div id="logo"> <h1><a href="#">mywebsite.com</a></h1><br /> <p><i>My motto here.</i></p> </div> </div> and I have a bunch of complicated CSS, but it just isn't working. Help! No, the CSS positioning that you have in your style is going to mess things up, coupled with the spacing that the h4 and p tags force on your layout too. I would skip the h1 and p and I and use CSS instead. Like this: <div id="header">
<div id="logo"> <a href="#">mywebsite.com</a> </div> <div id="motto"> your witty motto </div> </div> Now, in your CSS you can do something like this: <style type="text/css">
#logo { font-size:175%; font-color:#333; font-family: sans-serif; padding-top: 8px; padding-bottom: 1px; margin-bottom: 1px; } #motto { font-size:120%; font-color:#333; font-family: sans-serif; padding-bottom: 8px; padding-top: 1px; margin-top: 1px; } </style> See what I'm doing? Let the CSS do all the spacing and line height work and you'll find that you have complete control over your spacing. Further, recall that margin AND padding control the space around the contents of a container like "div", so you need to tweak it below the top one AND above the bottom one. Try that, see if it helps you get where you want. Note, however, that if you make your URL clickable then you have a more complicated issue with formatting because you can't just use the formatting in the ID, but need to touch the style itself. Quite doable, but more tricky...
Categorized:
HTML and CSS
(Article 7706,
Written by Dave Taylor)
Tagged: css, page layout, style sheets Previous: How do I find a driver for my Sony MP3 player? Next: Is syndicating my blog postings a recommended tactic? Subscribe!
You should use h1 and h2 instead of divs. It is more semantic and can give the same result. <div id="header> then in ou stylesheet use the following selectors: #header h1, and #header h2. You shouldn't need #header if you correctly use h3, h4, h5, h6... for the next titles in your site. You may have to reset margin and padding of h1 and h2 and other elements to zero before setting your own as different web browsers behave differently with default values... Posted by: Damien Le Berrigaud at November 27, 2007 12:55 AMI have something to say, now that you mention it, but ...
I do have a comment, now that you mention it!
|
Recommended
Recent Entries
Search
I Need Help!
Apple iPad Help
Articles and Reviews Auctions and Online Shopping Blogs and RSS Feeds Building Web Site Traffic Business and Management CGI Scripts and Web Site Programming Computer and Internet Basics d) None of the Above Facebook Help Google Plus Help HTML and CSS Industry News and Trade Shows iPhone and Cell Phone Help iPod, Sony PSP and MP3 Player Help Mac OS X Help Pay Per Click (PPC) Advertising Search Engine Optimization (SEO) Shell Script Programming Tech Support Video Help The Writing Business Twitter, LinkedIn and Social Network Help Unix and Linux Help Video Game Tips and Help Windows PC Help WordPress Help |