Hey! In this video I show you 5 different and equally useful ways to center different types of content with CSS!
Method #1 - 0:30
margin: 0 auto;
This method of centering is by far the one that I use the most. It is a simple, reliable and more of all quick way to center any sort of content, not just text.
Method #2 - 2:05
The flex property is one of the lesser known CSS properties and I think this is down to it being really temperamental. It takes a little practice to get good at but when you do, it's super powerful and you'll use it everyday. It also allows you to center without defining the width of the content.
Method #3 - 3:50
transform: translate -50%, 0;
Put the -50%, 0 in brackets. YouTube wouldn't let me.
This is probably my second or third favourite means of centering with CSS and it seems crazy that it was set up to work this way. By setting the left property to 50% and then using transform to drag the content back by 50% of it's own width, it allows for content to be centered every time. This can be used for more than just text also!
Method #4 - 5:30
Type center in angle brackets and close it off. Anything inside will be centered. YouTube won't let me type angle brackets here.
I would not recommend this for every piece of content that you need to be centered. It has known compatibility issues with older browsers and website tests will flag this as being outdated. It is good however if you're testing as it's quick, easy to write and remember and to be honest, it works!
Method #5 - 6:45
This is pure and simple CSS. This method is limited to just text but it is easy to write and will center your text with just this one parameter!
why do you have to go at a breakneck speed ? who wants that ? yes we can pause the video and think ..but ideally when i watch i just wanna watch and not pause or rewind ...a pause ..is a silence which is golden .
Here's a perspective for you. I want this speed because I have learned the basics, so what I need is a look into an expert's mind, which is what Marc is providing here. This tutorial isn't a "how to use CSS", it's a "how to do something specific in a few ways".
Anyway, I totally understand where you are coming from, Mohit, and I really appreciate your content, Marc.
My aim with these videos is to make them as short as possible. People don't tend to watch 30 minute videos to the end and I want everyone who sees this video to take away 100% of the knowledge that is presented in them.
I totally 100% understand that these videos are fast-paced but as you said, you're free to pause it and comment as much as you want and I'll always answer any questions you might have!
Thanks for your comment I appreciate it!
You have the same mind set I had when I started. I had no idea how someone could do stuff like this, but if you love it, you have no idea how easy it is. How satisfying it is to see a problem and know the code the fix it! It's worth the countless hours of bug fixing and coming to the point of almost crying/punching your monitor because of a misplaced semi-colon!
Message me on Facebook and we can talk the basics if you'd like!
I agree, I should probably do that just for readability! I wouldn't however say it's "incorrect".
Some people also type like:
There are many ways to do things and as long as it works and others can read it, I say it doesn't matter!
Thanks for your comment though dude, and for noticing something like that haha!
Haha I know man. I have barely any free time between my job (I work as a Developer 40 hours a week), teaching Development on Skype and trying to maintain a social life hahah!
Thanks for watching these videos though, I'm so glad people are enjoying them and learning from them.
I have a lot more CSS videos planned, this series is called "A Beginner's Guide to Development" so I want our small community that we have here to all learn at the same rate so I can make videos that slowly become more complex, you get me?
I might even upload another video tonight if I get time! If you have any questions or thoughts, message me on my Facebook page (link in the description) and I'll reply to you as quick as I can!
Thanks for your comment dude! Have a great day.
From least greatest (10) to greatest greatest (1), the poems in this list are limited to ones originally written in the English language and which are under 50 lines, excluding poems like Homer’s Iliad and Edgar Allan Poe’s “Raven.” Each poem is followed by some brief analysis. Many good poems and poets had to be left off of this list. In the comments section below, feel free to make additions or construct your own lists. You can also submit analyses of classic poetry to [email protected] They will be considered for publication on this website.
10. “The Road Not Taken” by Robert Frost (1874-1963)
Two roads diverged in a yellow wood, And sorry I could not travel both And be one traveler, long I stood And looked down one as far as I could To where it bent in the undergrowth;
Then took the other, as just as fair, And having perhaps the better claim, Because it was grassy and wanted wear; Though as for that the passing there Had worn them really about the same,
And both that morning equally lay In leaves no step had trodden black. Oh, I kept the first for another day! Yet knowing how way leads on to way, I doubted if I should ever come back.
I shall be telling this with a sigh Somewhere ages and ages hence: Two roads diverged in a wood, and I— I took the one less traveled by, And that has made all the difference.
Meaning of the Poem.
This poem deals with that big noble question of “How to make a difference in the world?” On first reading, it tells us that the choice one makes really does matter, ending: “I took the one less traveled by, / And that has made all the difference.”