Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS - fixed width span/div

Tags:

html

css

I am trying to layout the content for a popup dialog box, but not having much luck

I've tried using both spans and inline divs, but neither of them seem to respect the width or min-width CSS

any ideas?

Here's the Html

<div id="MessageBox" class="ui-dialog-content ui-widget-content" style="width: auto; min-height: 40.8333px; height: auto;" scrolltop="0" scrollleft="0">

<div class="popupKey">Bank Reference</div>
<div class="popupValue"></div>
<br>
<div class="popupKey">Amount</div>
<div class="popupValue">650.00</div>
<br>
<div class="popupKey">Currency</div>
<div class="popupValue">GBP</div>
<br>
<div class="popupKey">PaymentDate</div>
<div class="popupValue">02/06/2011</div>
<br>
<div class="popupKey">Remitter</div>
<div class="popupValue"></div>
<br>
<div class="popupKey">Senders Reference</div>
<div class="popupValue"></div>
<br>
</div>

and the CSS

.popupKey
{
    display : inline;
    min-width: 150px;
}

.popupValue
{
    display : inline;
    min-width: 150px;
}

I would like all the items in the popupValue column to be aligned

there's a JSFiddle here:

http://jsfiddle.net/NtK4Y/

like image 466
ChrisCa Avatar asked Apr 13 '12 08:04

ChrisCa


3 Answers

Inline content can't have a width defined. Try using display: inline-block or using display: block; float: left;

I've updated your jsfiddle; have a look at http://jsfiddle.net/NtK4Y/1/

like image 53
Arno Avatar answered Nov 09 '22 03:11

Arno


Use inline-block instead of inline.

You can see updated jsfiddle http://jsfiddle.net/NtK4Y/2/

like image 6
Chuck Norris Avatar answered Nov 09 '22 05:11

Chuck Norris


A float:left also might help your problem, they will be placed next to each other.

like image 1
mparryy Avatar answered Nov 09 '22 04:11

mparryy