A few times I’ve run into snags when centering elements in CSS, but I looked around the web and found this elegant little gem:
#MyClass
{
left: 50%;
margin-left: -140px;
width: 280px;
}
Advertisement
A few times I’ve run into snags when centering elements in CSS, but I looked around the web and found this elegant little gem:
#MyClass
{
left: 50%;
margin-left: -140px;
width: 280px;
}
0 Responses to “Coding Tip: Centering an Element With CSS.”