samedi 26 juin 2021

Is there an alternative to table-cell in CSS?

Whenever I want to align my divs horizontally I use table-cell as float:right/left is not working well for me

These are my divs which I want to align

Here's the CSS for it:

.left-cell {
    display: table-cell;
    width: 86% !important;
    position: relative;
    padding-left: 2vw;
    padding-right: 2vw;
}

.right-cell {
    display: table-cell;
    position: relative;
}

This works fine for most resolutions. Although my colleagues feel that this is not right as we are using table-cell without any table at all.

Is this considered bad practice? If yes, what are some alternatives to this as float is not working well for me?




Aucun commentaire:

Enregistrer un commentaire