Learning CSS - Points to remember
I started to learn Cascade Style Sheet (CSS)
Points to remember:
CSS is case sensitve : be carefull when you are writing CSS tags. For example if you have created a class name "myClass" in style sheet but you are trying to implement class to a html tag as "myclass" it will not work.
Divs and spans: div means division its used to divide a page int several parts while span is used to sub-devide a div.
"Using too many divs is often described as divitus and is usually a sign that your code is poorly structured and overly complicated." (Andy budd et al, CSS Mastery)
Two Elements #myid and .myclass
we use to main types of elements those are ID which starts with the sign "#" and class which starts with "."
Pseduo - classes:
Elements like links Internet solution team could have pseduo class like :link, :visited , :hover
we can use these
as
a:visited {any style}
a:link: {any style}
a:hover {any style}
The Universal selector (*)
can be use ad
* { any style}
Specificity or importanc
example :
This is for all forms in web site
form {width: 30em}
This is specific to search form.
form#search {widht: 15em}
Two ways:
You can link to them
tag <link href="/css/myfile.css" type="text/css" rel="stylesheet" tag end />
OR
you can import them
Tag <
style type="text/css"
!--
@import url("css/myfile.css");
-->
style tag end />
Multiple style cheets can be imported to one
@import url(/css/1st.css)
@import url(/css/2nd.css)
@import url(/css/3rd.css)
Html page
Basic file.css
1st.css
2nd.css
3rd.css
Commenting you code:
/* comments */
No comments:
Post a Comment