5 reasons why I think CSS is really messed up

clear, comprehensible and logical – so that everyone knows them
simple, efficient and compatible – to be easy to work with
Rules that do not meet these criteria are difficult to apply and especially confusing for beginners. However, since we do not live in a perfect world, even web standards are not always optimal. I would now like to document in several cases that even CSS is burden by some, in my opinion, ill-conceiv things.

1. Dimensions of elements

As you know, in CSS the width is consider to be the width of the content of the element, the marginal parts – padding and border – are no longer count. The same applies to the height ( height ), the padding and borders are not includ in it either.

box-model
This is quite impractical, as web designers ne to know the full width and height of elements on a page to visually arrange them! They finally realiz this fact in the W3C and standardiz the box-sizing feature, thanks to which padding and border can finally be add to the width and height of the element .

Note: If the content of the element is another block element, the overall width and sometimes the height of the element will be increas by its margin , more on this in the next chapter.

2. Vertical offset

of the parent element and in this case represents the distance not from the next element in the order of the structure, but from the next content. It is shown in the following picture: In the horizontal direction, the ges are fold, in the vertical direction they are intertwin. The CSS declaration applies to the elements in the image div, p {margin: 3em; background: rgba(248,90,4,.3)}.

margin
Only when a non-zero padding or border is set to the parent element (more on that in the next chapter), the size of the borders of the elements will be unifi (provid, of course, that the same dimensions are specifi). Padding and border represent a kind of obstacle against which the margin stops and can no longer “overflow” the parent element.

If the given explanation sounds swen phone number data complicat, it is precisely because of the complexity of the arrangement and calculation of the ges of the elements.

phone number data

In the past, vertical centering

of blocks was a difficult problem to solve. The vertical-align property then did not apply to blocks (unless they were inside a table), tabular values fully trust that this research ​​of the display property were not support by IE 6. However, none of this would matter if it was possible to use margin to align the block to the center , specifically its value auto, which makes the size calculates the outer ges of the element automatically. However, it doesn’t scale evenly in the vertical direction, resulting in the element being stupidly squash cg leads to the top ge of the parent element instead of taking up a position in its center. Again, a situation arises where the vertical margin behaves differently than the horizo.

Scroll to Top