0
I recently saw an Indian make a navigation menu using HTML,CSS,JS but what intrigued me was he used display: block
and display: flex
in the same element. Maybe he made a mistake because until then I know that the last one to be declared is what gets the application. I even did tests but the last one is always applied!
Then the question becomes: it is possible to use these 2 display in the same element?
In the same element there is no way. Repeated attributes follow the rule of specificity to define which will be used. You can see this by "inspect element" too.
– Rafael Tavares
The
display
has two variants, one inside and one outside. What I mean is that an element that receives a display property can affect how children behave, and/or how it behaves in relation to adjacent elements. An example of this is thedisplay: inline-flex
This display leaves the elements with inline display in relation to the siblings, but the children behave as if the father were flex. In short, the element becomes inline outwards and flex inwards at the same time. But two display property in the same element, the one that comes last subscribes to the previous– hugocsl