0

Clear and Float in CSS

1. Does "clear" only affect floating? Nothing else can be cleared? 2. If "clear" only affects floating, why not use float: no-left or no-right or not both to do the same job? This should be more convenient or straightforward to memorize.

7th Jan 2018, 11:20 PM
Bo Yang
Bo Yang - avatar
1 Resposta
+ 4
1. I understand float and clear to be paired properties. 2. Old standard, in English. "Clear" is in the sense of "A plane clearing the tallest mountain peak", that is: instead of finding the first place you could fit your stunt plane in a slot between peaks, go over (past) the tallest entirely. Maybe they thought 'clearing' in this sense was most precise. Nice visuals and historical changes: https://css-tricks.com/all-about-floats/ https://css-tricks.com/the-how-and-why-of-clearing-floats/ https://css-tricks.com/snippets/css/clear-fix/ ============= Coming soon? ============= They hint at new ideas, but see this: "CSS Grid has been in development behind a flag in most browsers for over 5 years..." https://developers.google.com/web/updates/2017/01/css-grid CSS Grid changes everything - Amazing presentation (32:06) https://youtu.be/7kVeCqQCxlk
8th Jan 2018, 2:44 AM
Kirk Schafer
Kirk Schafer - avatar