hi i would like to know if there is a wayI know some css and html
but i am not a guru
i have been doing some web development mobile lately, and just doing the layout is killing me.
i am tired of doing and trying something by guessing or hacking, i want to know all the rules, so i won’t try something that for sure is not going to work.
can anyone recommend me a web/html/css book for which it will explain like:
- by default, the div tag takes the whole width
- what happens when a child element in the div tag is wider than its parent if parent width is not set or set
- things like if you set width to 100%, and add margin to it, it actually will become longer than expected
etc
all these details i found out after hours of searching or trying myself
i know there is no way a book can describe all the problems
but i believe some books will give you at least the fundamental, how each element, say div is suppose to behave.
can anyone suggest a book has those ‘gotchas’ or rules?
thanks
Google is your best friend, there are many free resources, but check out lynda.com, it has tons of videos and articles that will help you learn html, css, javascript, php. actionscript, etc. It’s not free but $25 a month isn’t bad.
as for your questions:
by default, the div tag takes the whole width
Block elements take on the width of their parents unless otherwise specified.
what happens when a child element in the div tag is wider than its parent if parent width is not set or set
If the parent div has no set width it will be either the width of it’s parent, or the width of it’s largest child, whichever is larger.
Things like if you set width to 100%, and add margin to it, it actually will become longer than expected etc
Imagine block elements like divs as a box, the width effects the box, then around that is padding, then border, then margin. So a div with width 100px, padding left and right 5px, 1 pixel border, and 10 pixel margin left and right, the actual width is 132px. http://www.w3.org/TR/CSS2/box.html