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.
Governors: senators (or knights) who ruled the provinces of the Roman empire.
The first Roman province, Sicily, was conquered after the First Punic War (241 BCE), and the Senate decided that it had to be ruled by a praetor. This meant that civil (not military) law was applied -at least under normal circumstances- and that the new territories were governed by magistrates who served a limited time. The Romans never did change these principles, although other types of governorship became more important: the propraetor and proconsul were, as their names suggest, former praetors and consuls who stayed in a territory they had recently or not yet fully conquered. The revolutionary politician Gaius Sempronius Gracchus legislated that these promagistrates were to be appointed by the Senate (123 or 122).
The governor of any Roman province always had four tasks.
To start with, he was responsible for the taxes. As the Senates financial agent, he had to supervise the local authorities and the private tax collectors, the notorious publicans. To facilitate things, a governor could mint coins and negotiate with wealthy institutions (e.g., temples) that could advance the money. His second task was that of accountant: he inspected the books and supervised large scale building projects. Next to these financial tasks, the governor was the provinces supreme judge. Appeal was not impossible, but the voyage to Rome was expensive. He was supposed to travel through the main districts of his province to administer justice in the assize towns. Finally, he commanded an army. In the more important provinces, this could consist of legions; but elsewhere, there were only auxiliaries.
Under the late republic, the number of provinces rapidly increased, and therefore, Pompey the Great proposed a new law, the Lex Pompeia de provinciis , in which former praetors and consuls were obliged to become governor five years after their term in office (53). At more or less the same time, he had himself elected as governor of several provinces, which were not governed by himself, but by his representatives, the legati .
The emperor Augustus copied this idea when he changed the empire, until then ruled as a republic, into a monarchy. He was made governor of almost all provinces with legions, and used legati to rule them. At the same time, the rest of the empire was governed by proconsuls. So, there were two types of governors:
Proconsuls. In fact, these men were not former consuls, but former praetors. They governed the senatorial provinces and typically served twelve months. Only the rich provinces -Asia and Africa- were entitled to a proconsul who was indeed an ex-consul. Legati Augusti pro praetore. These men served in the emperors provinces with the armies (the imperial provinces ). Usually, their term in office lasted thirty-six months, although the emperor Tiberius preferred longer terms.
There was a third group of governors. In several unimportant provinces, prefects were appointed. Usually, these military men governed parts of larger provinces. The best known example is Pontius Pilate, who governed Judaea, an annex to Syria. Prefects were not senators but knights. Egypt was also governed by a prefect, not because it was unimportant, but because it was the emperors own possession. When Septimius Severus conquered Mesopotamia, he used the same construction.
After the mid-first century, the prefects were gradually replaced by procurators (except for Egypt). The only difference is that prefects were soldiers and procurators were fiscal officials. It tells something about the success of the Pax Romana .