Lior Lior - 4 months ago 8
HTML Question

How to center an element that is wider than its parent element?

I currently have a div with a fixed width of 900px.

I'd like to add a child iframe with a fixed width of 950px, and I'd like it to be perfectly aligned to the center.

How can that be done?

Thanks.

Answer
.container {
    width:900px
}

iframe {
    margin-left:-25px;
    width:950px;
}