• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

My Monkey Do

A Log of Coding Solutions

  • Home
  • Web Hosts
  • Tools
  • About

CSS Width not working

June 30, 2012 by Webhead

Problem

I am replacing a two-column table where the first column is on the left with a width about 90% and the 2nd column is on the right with a width of 10%.  The following HTML does not work as the span width only is as wide as the text.  When I use floats on the spans, it takes the span elements out of the layout so that the li collapses as if there’s nothing in it.

<ul>
<li><span>left</span><span>right</span></li>
</ul>

Solution

Turns out I need to set the display attribute to inline-block for the span elements.  Now the width works as expected.

 

keywords: css width no effect
source: http://csscreator.com/node/28049

 

Filed Under: Coding Tagged With: css

Primary Sidebar

Topics

apache apple block editor chrome cms css debug eCommerce embed firebug firefox git gmail goDaddy google hosting htaccess html html 5 IE crap image iPad iPhone javascript jquery linux localization mac os x ms sql mysql open source optimize php php 5.3 responsive rest api seo svg tinymce woocommerce wordpress wpengine xss yii youtube




Categories

  • Coding
  • Off the Shelf
  • Plugins
  • Random Thoughts
  • Server Stuff
  • Tools