1 reply [Last post]
herbshirt
Offline
newbie
Last seen: 14 years 21 weeks ago
Joined: 2007-10-21
Posts: 1
Points: 0

Hi Guys,

I've been a web designer using photoshop and d/w and up til now relied on others to convert my psd to css but finally found some time to get into the craft myself.
I've just bought Topstyle, downloaded some css templates to pick apart, browsed forums etc but it seems people tackle css differently.

It seems an understanding of the idea of 'inheritance' is important so would I be right in saying that all the general default styles should be determined as early as possible in the code?
For example:

html,body{
background: #ffebcd;
color: maroon;
margin:0;
padding:0;
font-family:verdana, sans-serif;

}
p{
padding: 10px;
text-align:left;

}

Then the div;s for the layout:
div#header h1{
height:160px;
line-height:80px;
padding-left:300px;
padding-top: 10px;
background: url(images/header-bg2.gif);
color: #79B30B;
}

Then if something is to be styled something OTHER than the default style then a CUSTOM class to be used?
Such as:
.emphasis{
color:red;}

Ami kind of on the right track?

I guess for me it seems a major benefit of css is the nice lean code. So if I'm going to learn it I want to learn the habits of keeping the code as lean as possible from the start.

Thank you for your guidance.

Herb.

thepineapplehead
thepineapplehead's picture
Offline
Moderator
Last seen: 10 weeks 12 hours ago
Timezone: GMT+1
Joined: 2004-06-30
Posts: 9683
Points: 819

Pretty much, yes, that's the

Pretty much, yes, that's the way I do it.

The code at the top (HTML, Body etc) is usually used to set basic things like removing default margins, setting the site's font size, colours, things like that, so you don't have to repeat them on every element.

Next is smaller things on elements - setting every paragraph to have a top border, for example, or all links to be underlined and green.

Then comes the actual elements themselves - as in your example, headers in specific divs.

Finally, things you need to target, like copyright text.

Verschwindende wrote:
  • CSS doesn't make pies