Reputation: 3969
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:
can anyone suggest a book has those 'gotchas' or rules?
thanks
Upvotes: 0
Views: 268
Reputation: 89
Since you asked about all rules, you might find this css book useful. It's a complete visual reference to every single CSS property in common use.
Upvotes: 0
Reputation: 2917
I tried some ebooks and got bored. What helped me a lot was memorizing cheat sheets: http://sixrevisions.com/resources/cheat_sheets_web_developer/ Make sure you write & re-write what you've learnt to drum it in your head.
1) By default a div is auto, with no width defined it's 0.
2) Child element wider makes parent as wide if nothing (auto) is set or a width is set on the parent.
3) adding a margin to an element that is 100% of it's parent is literally as it sounds.
Best thing to do is to understand the box model when it comes to that stuff: http://www.w3schools.com/css/css_boxmodel.asp
Upvotes: 0
Reputation: 2407
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
Upvotes: 0
Reputation: 1547
you can learn just about anything about web development on the internet. there is a sight called w3schools.com (this is where I learned). It's totally free.
PS: you won't be able to live with just css and html. Your going to have to learn javascript as well as this will allow for dynamic content. You may also need php in the future as well.
Upvotes: 1