On Thu, Mar 6, 2014 at 1:22 PM, John <[email protected]> wrote:
> In web development and programming, what IS a "hack" to begin with?
>
> >From the print world I can cite examples of things done by designers in
> >InDesign, say, where they didn't know how to handle an exception to their
> >design, so they slapped a white box over it to hide the unwanted bits and
> >called it good.
>
> To me, that is a hack. And it's a pretty heinous one that really does lead to
> more tinkering and fixing down the road.
>
> but as I'm reading responses here, it's clear that float, clear and clearfix
> are in the spec, and so..intended to used, correct?
>
> When we encounter the collapsing margins problem, is the use of a border or
> of padding instead of margin a hack to the problem? Or, is it a using of
> available tools to correct an unwanted outcome?
>
> there's nothing computationally wrong with slapping a white box over
> something you want to cover up..inDesign won't explode. The file will print
> or rip to PDF. It is unprofessional to do so because it fails to rectify an
> issue and leaves a mess for somebody else to clean up. For the guilty
> designer, it belies a lack of skill and tendency toward cutting corners out
> of laziness.
>
> At my stage of web dev skill, I couldn't apply those last sentences to the
> use of floats, clear and clearfix.. rather, they seem to be a regular
> practice..perhaps a best practice.
>
> J
In my opinion, a CSS hack is an exploit of browser behavior (or
misbehavior) to "solve", in this case, a layout issue. And to be
clear, "clearfix" as an idea, is not in the spec as a self contained
"thing". "Clearfix" is a group of CSS definitions.
Here is the clearfix I use:
/* CLEARING */
/* For modern browsers */
.clear:before, .clear:after {content:""; display:block;}
.clear:after {clear:both;}
.clear {zoom:1;}/* For IE 6/7 (trigger hasLayout) */
While these definitions are using real in-the-spec css, they are
taking advantage of browser behaviors to cause a wrapper element to
contain floated elements within it.
Smarter people, feel free to correct me...
HTH
--
Tom Livingston | Senior Front-End Developer | Media Logic |
ph: 518.456.3015x231 | fx: 518.456.4279 | mlinc.com
______________________________________________________________________
css-discuss [[email protected]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/