Cómo alinear las cosas en CSS

Imprescindible el artículo How To Align Things In CSS:

There are a few ways to align elements in CSS. In this article, Rachel Andrew explains what they are with some tips to help you remember which to use and why.

Los consejos que da son:

To wrap up, I have a quick summary of the basics of alignment. If you remember these few rules, you should be able to align most things with CSS:

  1. Are you aligning text or an inline element? If so, you need to use text-align, vertical-align, and line-height.
  2. Do you have an item or items you want to align in the center of the page or container? If so, make the container a flex container then set align-items: center and justify-content: center.
  3. For Grid Layouts, the properties that start with align- work in the Block direction; those which start with justify- work in the inline direction.
  4. For Flex Layouts, the properties that start with align- work on the Cross Axis; those which start with justify- work on the main axis.
  5. The justify-content and align-content properties distribute extra space. If you have no extra space in your flex or grid container, they will do nothing.
  6. If you think you need justify-self in Flexbox, then using an auto margin will probably give you the pattern you are after.
  7. You can use Grid and Flexbox along with the alignment properties for tiny layout jobs as well as main components — experiment!

Cómo manipular los colores CSS con JavaScript

Un excelente artículo How to manipulate CSS colors with JavaScript:

I know you’re here to learn about manipulating colors — and we’ll get there. But before we do, we need a baseline understanding of how CSS notates colors. CSS uses two different color models: RGB and HSL.

Both the RGB and HSL color models break down a color into various attributes. To convert between the syntaxes, we first need to calculate these attributes.

With the exception of hue, each value we have discussed can be represented as a percentage. Even the RGB values are byte-sized representations of percentages. In the formulas and functions below, these percentages will be represented by decimals between 0 and 1.

I would like to note that I will not cover the math for these in depth; rather, I will briefly go over the original mathematical formula and then convert it into a JavaScript formula.

Recetas de CSS

Muy interesante todo lo que se explica en CSS Layout cookbook de Mozilla Developer Network:

The CSS layout cookbook aims to bring together recipes for common layout patterns, things you might need to implement in your own sites. In addition to providing code you can use as a starting point in your projects, these recipes highlight the different ways layout specifications can be used, and the choices you can make as a developer.

Las recetas que ofrece hasta ahora son:

Recipe Description Layout Methods
Media Objects A two-column box with an image on one side and descriptive text on the other, e.g. a facebook post or tweet. CSS Gridfloat fallback, fit-content() sizing
Columns When to choose multi-column layout, flexbox or grid for your columns CSS GridMulticolFlexbox
Center an element How to center an item horizontally and vertically FlexboxBox Alignment
Sticky footers Creating a footer which sits at the bottom of the container or viewport when the content is shorter. CSS GridFlexbox
Split Navigation A navigation pattern where some links are visually separated from the others. Flexboxmargin
Breadcrumb Navigation Creating a list of links to allow the visitor to navigate back up through the page hierarchy. Flexbox
List Group with Badges A list of items with a badge to display a count. FlexboxBox Alignment

Los lenguajes que existieron antes que CSS

Me parece fascinante el artículo The Languages Which Almost Became CSS. Pura arqueología web en la que se detallan algunas de las propuestas que se desarrollaron antes de que CSS se convirtiese en el estándar para definir la presentación de las páginas web.

Algunas de las propuestas fueron:


@BODY fo(fa=he,si=18)



(BODY fontSize=normal
(H1 fontSize=largest



<font size=”12pt” bckcol=”white” fontcol=”black”>
<e-i-c gi=”h1″><font size=”24pt” bckcol=”red”, fontcol=”white”></e-i-c>
<e-i-c gi=”h2″><font size=”20pt” bckcol=”red”, fgcol=”white”></e-i-c>
<e-i-c gi=”a”><font fgcol=”red”></e-i-c>
<e-i-c gi=”cmd kbd screen listing example”><font style=”monoser”></e-i-c>



(element H1
(make paragraph
font-size: 14pt
font-weight: ‘bold))


Y muchos otros que se desarrollaron y desaparecieron.