# Centering a SPAN

**URL:** <https://forum.kirupa.com/t/centering-a-span/267679>\
**Category:** web dev\
**Created:** [August 4, 2008, 6:08pm UTC](https://forum.kirupa.com/t/centering-a-span/267679 "2008-08-04T18:08:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![NeoDreamer](https://avatars.discourse-cdn.com/v4/letter/n/ccd318/32.png) [@NeoDreamer](https://forum.kirupa.com/u/NeoDreamer)\
**Post date:** [August 4, 2008, 6:08pm UTC](https://forum.kirupa.com/t/centering-a-span/267679/1 "2008-08-04T18:08:10Z")

</div>

```auto

#someBox {
   margin: 0 0 0 40%;
   background: red;
}

<span id="someBox">some text</span>

```

I’m having difficulty centering a span (variable width) in 3 major browsers. If I add “_display: block; width: 20em;_”, everything is consistent with all 3 browsers, but I really didn’t want static width.

[LIST]  
[_] **IE7:** no background  
[_] **Safari:** left justified  
[\*] **FF:** perfect  
[/LIST]
