Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
how can they answer the question fundamentally wrong each time? even if they answered "letter-spacing" at least the answer would have been CSS
-
Div has to be display: block which it is by default and margin-left and margin-right set to auto. IMG are display inline by default, for example, and would need to be set to display: block to be centered like this. And text-center the parent might help too.
-
@uziiuzair only down side to margin: 0 auto; is you lose top and bottom margins. margin-left:auto;margin-right:auto; will keep the margins on the bottom. Lots of times the top/bottom margins aren't needed though.
-
ZaLiTHkA8369y@wolfish, have any of them ever thought to ask about the div's parent? Not sure how anyone can give a proper answer without knowing what element the div is being centred in.. :/
For the record, I'd probably use flexbox with magic margins to centre it on both the X and Y axis.
And yes, I know "magic margins" isn't really a thing, but if you Google it you'll find the relevant CSS-Tricks page that shows what I mean. -
wlinx3049y@ZaLiTHkA Yes it was provided with full short html and css, visual example of how it display, and event got /* ... */ suggestive comment where person should start, but still some people ignored that and put the div in <center> tag as solution ;p
it was only to check if the candidate know some basic css
its not used anymore in our interviews but I got old copy of it, the question looked like this (texts are in polish) https://imgur.com/MEk7KgX
Related Rants

What only relying on JavaScript for HTML form input validation looks like
How to vertically center in css..
Yeah no
One of questions in short test that we give to interviewed frontend devs is:
"How would you center a <div> horizontally with CSS?"
So many still answer with <center> ...
undefined
css
html