3 ms·
Feel your pain - I remember vividly struggling with these things when beginning. here's a few hints.. - Avoid floats as much as possible. They are useful, but
by danpeddle 11y ago
Feel your pain - I remember vividly struggling with these things when beginning. here's a few hints..
- Avoid floats as much as possible. They are useful, but understanding where and when to use them takes time. Using display: inline-block will take you a long way.
- Height comes from the parent element, in general. A really common mistake is trying to do something like 'height: 100%;' when the parent element has a height of zero and not getting why it doesn't work. Here's an example that uses 80%/20% height layout, without any craziness: http://codepen.io/dazld/pen/jbrLoa http://codepen.io/dazld/pen/jbrLoa
- Whitespace is important with inline elements. Trying to figure out why inline-block stuff has a gap? Check if there is any whitespace around the markup, remove it and see if that helps.
Playing with CSS & HTML is incredibly rewarding and fun once you develop fluency - and not as complex & arbitrary as may seem at first. Stick with it!