English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Why do they set sometimes the left margin to -100%? The column looks at its place in the layout, why not just set the margin to 0?

#leftcolumn{
float: left;
width: 230px; margin-left: -100%;

2007-02-25 01:56:35 · 1 answers · asked by Lady of the Lowlands 3 in Computers & Internet Programming & Design

1 answers

That is kind of a CSS hack to get columns to flow correctly with each other. In certain layouts, if you want some floated columns to be of a static width and the remaining columns to take up the remaining width (even though that width is variable based on the size of the users' browsers), it can be accomplished using negative margins.

There are more "correct" ways to do it (i.e. without using negative margins) but some people have a hard time figuring those out, so they use the hacks instead.

2007-02-25 03:10:08 · answer #1 · answered by Rex M 6 · 1 0

fedest.com, questions and answers