Sorry, let me fix that:
Main Topics
Browse All TopicsHi,
I'm trying to generate a generic stylesheet for my projects. I would very much appreciate it if someone could let me know the best practise for defining fonts in a stylesheet.
Surely a <p>, <h1> etc tag should be display:block by default, yet somewhere down the line of my layouts I'm having to stipulate it AND the exact width of the div it is contained within, or else I'm getting display:inline behaviour - the same thing happens with <li>'s - I'm confused about what the definitive answer (if that's ever possible with so many interpretations).
So for example, what would be the correct css for the following:
* {
margin:0em;
padding:0em;
}
body {
margin:0 0 0 0;
padding:0;
background: #000;
font-weight: normal;
font-size: 9pt;
font-family: arial, futura, helvetica ;
}
h1,h2,h3
{
font-weight: normal;
}
p
{
font-weight: normal;
font-size: 1.05em;
line-height: 1.2em;
padding-top: 0.77em;
padding-bottom: 0;
margin-bottom: 0;
}
#right-content {
float:left;
padding: 15px 0 0 0;
width:600px;
}
#right-content p {
float:left;
width:595px; /* Needed ?? or should it be width:100% ? */
padding:0 0 12px 5px;
}
<div id ="right-content">
<p>What's right, </p>
<p>what's wrong - on a line below, dammit!</p>
</div>
As I posted the code above from my stylesheet, I'm wondering whether * { margin:0em;padding:0em; } is what's causing me problems.
Comments very much appreciated
Tony
This question is in progress.
Our experts are working on an answer right now.
Sign up for immediate access to the solution once it becomes available.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
HI,
Thanks for your comments. The problem is that the <p> tags sometimes go side by side (display:inline) when they should be one on top of each other (display:block;). <p> tags are display:block by default arent they? Is it really necessary to state the width of the div in the <p> tag? I'm confusing myself with what I do and don't understand. Perhaps the best thing is how a base stylesheet should be constructed when it comes to these issues.
I'm not a fan of using what I consider un-gainly tags. I'd prefer:
<div id="container">
<h2>Title text</h2>
<p>Para text</p>
</div>
Make sense?
The main question here is what is the recommended way to structure fonts within a typical layout, in particular, looking at widths. Should all widths be stated within the div container and never within the font (p,h1,h2 etc) tags?
Can anyone point me to a css 'template' example which contains all 'best practise' techniques for layouts?
Many thanks,
Tony
Business Accounts
Answer for Membership
by: exalkoniumPosted on 2009-09-29 at 08:31:15ID: 25450163
The * is pretty much a wildcard for all page elements, so you effectively eliminated the padding and margins for all page elements until you define new ones through CSS.
Now then, your float declaration can only be used on positioned elements (e.g. position:relative;). I would change your P tags to divs, position them relatively, and then you can use the floats. You then don't have to make size declarations:
Select allOpen in new window