Skip to main content
adding code snippet
Source Link
iorgu
  • 3.2k
  • 3
  • 21
  • 39

The way I usually do it is using absolute position:

#inner{
  left: 0;
  right: 0;
  margin-left: auto;
  margin-right: auto;
  position: absolute;
}

#inner {
  left: 0;
  right: 0;
  margin-left: auto;
  margin-right: auto;
  position: absolute;
}
<div id="outer">
  <div id="inner">Foo foo</div>
</div>

The outer div doesn't need any extra properties for this to work.

The way I usually do it is using absolute position:

#inner{
  left: 0;
  right: 0;
  margin-left: auto;
  margin-right: auto;
  position: absolute;
}

The outer div doesn't need any extra properties for this to work.

The way I usually do it is using absolute position:

#inner {
  left: 0;
  right: 0;
  margin-left: auto;
  margin-right: auto;
  position: absolute;
}
<div id="outer">
  <div id="inner">Foo foo</div>
</div>

The outer div doesn't need any extra properties for this to work.

deleted 26 characters in body
Source Link

The way I usually do it is using absolute position:

#inner{
    left: 0;
    right: 0;
    margin-left: auto;
    margin-right: auto;
    position: absolute;
}
#inner{
  left: 0;
  right: 0;
  margin-left: auto;
  margin-right: auto;
  position: absolute;
}

The outer div doesn't need any extra propertitesproperties for this to work.

The way I usually do it is using absolute position:

#inner{
    left: 0;
    right: 0;
    margin-left: auto;
    margin-right: auto;
    position: absolute;
}

The outer div doesn't need any extra propertites for this to work.

The way I usually do it is using absolute position:

#inner{
  left: 0;
  right: 0;
  margin-left: auto;
  margin-right: auto;
  position: absolute;
}

The outer div doesn't need any extra properties for this to work.

deleted 2 characters in body
Source Link
Stickers
  • 79.1k
  • 24
  • 157
  • 195

The way I usually do it is withusing absolute positioningposition:

#inner{
    left: 0;
    right: 0;
    margin-left: auto;
    margin-right: auto;
    position: absolute;
}

The outer div doesn't need any extra propertites for this to work.

The way I usually do it is with absolute positioning:

#inner{
    left: 0;
    right: 0;
    margin-left: auto;
    margin-right: auto;
    position: absolute;
}

The outer div doesn't need any extra propertites for this to work.

The way I usually do it is using absolute position:

#inner{
    left: 0;
    right: 0;
    margin-left: auto;
    margin-right: auto;
    position: absolute;
}

The outer div doesn't need any extra propertites for this to work.

Post Made Community Wiki by Salman Arshad
I accidentally said fixed positioning instead of absolute positioning.
Source Link
william44isme
  • 877
  • 2
  • 13
  • 25
Loading
Source Link
william44isme
  • 877
  • 2
  • 13
  • 25
Loading