Faux Absolute Positioning (A List Apart)
2 seguidores
http://www.alistapart.com/articles/fauxabsolutepositioning<fieldset>There are two popular approaches to positioning with CSS: float and absolute positioning. Both approaches have their pros and cons. My teammates and I have developed a new positioning approach that gives us the best of both worlds. After quite a bit of experimenting and testing, it?s time to share the technique with the rest of the world and see how we can work together to improve it. I?m calling it ?faux absolute positioning? after the faux columns technique that simulates the presence of a column.</fieldset>
a ver si los gurus en CSS nos iluminan con una critica constructiva
orange
Servir puede servir, pero como dicen en el propio artículo
<fieldset>Faux absolute positioning is very much inspired by and intended for grid-based design and is more rewarding with more complex layouts. If you have a two-column fixed-width design, this may not be your technique of choice.
</fieldset>
Yo diría que en estructuras sencillas se puede conseguir lo mismo sin tanto pollo. Pero bueno, en cualquiera de los casos yo voy a probarlo, a ver si mola.
:D
zigotica
buena crítica, si señor, yo es que estoy algo obtuso ya con el CSS, pero para cosas muy sencillas creo que puede servir, por ejemplo si tienes que hacer una web para un CD. en cualqueir caso siempre hay que poner en la balanza los pro's y contra's.
orange
Ya me lo he mirado, vamos a ver...
Para empezar a mi este tipo de "técnicas milagrosas" (y un tanto farragosas diría yo) siempre me resultan un tanto extrañas y rebuscadas. Al fin y al cabo se comen la cabeza hasta el infinito para evitar el uso simple de float y absolute... cuando en realidad todo lo que hacen se puede hacer usando float y absolute, y parseando algunos bugs ultraconocidos y fácilmente reconocibles.
Dicho esto, pues bien, es una técnica más, que - al igual que las otras - no es perfecta y tiene sus pros y sus contras.
De lo que me ha parecido reseñable:
<fieldset>Every row in the grid will always have height dependent on the content or as defined in CSS, and will always take up 100% of the width, no matter how many columns are defined in the row.</fieldset>
Vale, está bien, pero eso se puede hacer fácilmente con cualquier ténica de "clearing floats". Aunque es cierto que es complejo (o imposible) de conseguir con posicionamientos absolutos.
<fieldset>Another advantage of the technique is that it mitigates much of the fragility of floats.</fieldset>
Bien, pero de nuevo nada que no podamos resolver de otras maneras.
<fieldset>When the content of a floated box is wider than the box itself, it pushes the next box to the right (and by consequence, the box often drops down)..........n our view, it?s better to risk overlap than risk breaking the whole layout.</fieldset>
Esto lo ponen ellos como una "ventaja" y a mi me parece lo contrario. Si el layout de una página peta yo prefiero que los contenidos se descoloquen, pero sigan siendo visibles, a que se tapen los unos con los otros y se dificulte el acceso a la información. De primero de accesibilidad.
Desventajas.......
<fieldset>If you want to align elements on the left, you cannot use a unit that is different from the unit in which the width of the canvas is defined, because you cannot calculate the offset.</fieldset>
Pues eso, dependiendo del diseño puedes no poder utilizar esta técnica.
Y esto...
<fieldset>And since it is a new technique that hasn?t been tested by thousands of users, it should still be considered experimental, as you may see unexpected results in your actual combination of markup, CSS, and browser.</fieldset>
... unido a esto...
<fieldset>when an element larger than the canvas precedes other elements in the HTML source, the trailing elements on the same line will be pushed to the right by an amount equal to the difference in width between the the first element and the canvas.</fieldset>
... pues da algo de miedo.
Como conclusión me remito a lo primero que he escrito, aunque yo creo que merece la pena animarse a utilizar la técnica en algún sitio (no demasiado importante al principio) a ver qué tal va.
Al final creo que algo tan complejo sólo tiene cabida en proyectos suprespeciales, como ellos mismos dicen al comienzo del artículo:
<fieldset>my team was developing a web-based WYSIWYG form generator that allows the user to drag items to arbitrary locations on a canvas. We needed to let our users create beautiful forms that didn?t use overly static layouts and to let them align columns as needed</fieldset>
Vale tío, tú tenías un encargo infernal y esta era la única manera de solucionarlo. Ferpecto.
Por último, me he encontrado una cosa que no está al nivel que se le presupone a A List Apart: "...but absolutely positioned elements have no height..." ¿Comorl? ¿Perdón? ... Los elementos posicionados de forma absoluta tienen height como cualquier otro hijo de vecino. Otra cosa es que estén fuera de flujo y sus dimensiones no afecten (a nivel de tamaño o posicionamiento) al resto de elementos, lo que siempre es un grano en el culo.
orange
Interesante, mañana le echo un ojo, a ver qué cuentan.