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
-
Those answering "first", could that be due to already being used to that syntax? I ran the idea past my wife who isn't a coder and she intuitively chose the second syntax option. I'm of the opinion that this kind of thing is what intimidates people new to coding.
-
@stackodev except the first makes more sense than the 2nd.. even from a newb stand point. I asked my husband the same question you did and he chose the first so :/
-
zareef1298ydiv {
margin: 0 auto;
}
This is how it should be written .... Also if everything was intuitive then developers won't be needed. -
fyroc58608yHonestly the new CSS is what started to be funky to me. I remember the days when to center something was as simple as valign:middle; align:center;
-
That's because centering something in this way was not really supported in those days of CSS and the margin: auto thing is more of a widely accepted hack.
Flexbox, after it got its syntax fixed and standardized now and is supported in all major browsers, is a beautifully intuitive way to center and align anything in everything! -
.parent {
display: flex;
justify-content: center; /* Horizontal */
align-items: center; /* Vertical */
}
That's as long as flex-direction is set to "row", which is default.
Related Rants
-
paranoidAndroid17Consultant: "you should deploy a website. Use wordpress and have a draft ready in a few days. It's easy." Me:...
-
jodee92911BETA USER: Is this feature working? When I add a link I get an error that says "URL cannot be more than 255 ch...
-
Number09Receives email from warranty guy in work. Warranty: "Hi, see attached scan in PDF form. I normally fill the b...
Ok, people who invented CSS... which seems more intuitive and easier to read?
div {
margin-right: auto;
margin-left: auto;
}
Or
div {
center-this-damn-div: true;
}
undefined
why?