mardi 21 juin 2016

Evaluating percentages to pixels in SASS


Currently, I'm setting a variable to correspond to a circle's width and height, like so:

$circle-diameter: 70%;

.circle {
    width: $circle-diameter;
    height: $circle-diameter;
}

However, the circle's width becomes 70% of the parent element's width, and the height becomes 70% of the parent element's height, which yields an oval that is wider than it is tall. Ideally, I'd like to convert .circle-diameter to a fixed size and assign the circle's width and height to that fixed size. Is there a solution for this in CSS/SASS?


Aucun commentaire:

Enregistrer un commentaire