Domain Empire

Best Start ?

Spaceship Spaceship
Watch

DnEbook

DataGlasses.ComTop Member
Impact
5,741
As i am trying to learn good habits from the start i am going ask which is the better proposition out of the follow few examples, i have looked at a few online videos and seeing variations in the info given. At the end of the day they all seem to work but it would be good to start in the best manner.

Example One of how to start a css file All through the html page he only uses one class example (for the banner)
@charset "UTF-8";

article, aside, footer, header, main, nav, section {
display:block;
}

article, aside, footer, header, main, nav, section {
pading: 0;
margin: 0;
}

body {
background-color:#777;
width:960px;
margin-left:auto;
margin-right:auto;
}

Etc ...



Example Two Using Classes all the through the html file for reference in the css file


<body class="body"> on the html file which is then used to style via .body on the css { example}

.body {
background-color:#777;
width:960px;
margin-left:auto;
margin-right:auto;
}

Etc….

After this he goes onto add a class to nearly every thing, article, aside, footer, header, main, nav, section


So i am wondering if the top example where most is done within the page tags is normally used or is it better practice to be adding a class to all the page tags ( article, aside, footer, header, main, nav, section) as i construct a webpage,
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Personally, I'd use page tags and then use classes later if I want to differentiate one from the other.

body{
/*body css*/
}

span{
/* generic span css*/
}

etc..

Now if I want some span to have specific attributes, this is where I use classes

/*bold texts*/
.boldspan{
font-weight:bold;
}

/*red texts*/
.redspan{
color:red;
}

something like that
 
1
•••
Personally, I'd use page tags and then use classes later if I want to differentiate one from the other.

body{
/*body css*/
}

span{
/* generic span css*/
}

etc..

Now if I want some span to have specific attributes, this is where I use classes

/*bold texts*/
.boldspan{
font-weight:bold;
}

/*red texts*/
.redspan{
color:red;
}

something like that


Cool i do understand what you mean, make me laugh, 'span' is one of the new words i am yes to come across, i have the feeling i could get man varied answers on this one. Just thought it was interesting to see the different approaches on the two vids i watched, many thanks for your imput !
 
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back