tags:

views:

35

answers:

1

Let's say I have a style sheet

dt{
width=15%;
}
dt x{
  background-color:red;
  ????
}

And some html...

<dt>abc
  <x> xyz </x>
</dt>

What if anything can put in place of the ???? to cause the box being defined by 'dt x' to be the remainder of dt?

The idea being that there should be a box 15% wide with text "abc" on the left with NO background color and the remainder of the 15% filled with red background.

A: 

float:right;

That would give you (basicly) what you want.

IMO you would want to give a fixed width to the ABC and contain it in a div or something maybe.

dt x1 {
    width:25%;
}
dt x2 {
     width:75%;
}

<x1>abc</x1><x2></x2>

maybe.. you might have to state they're inline but I think that's default

edit:

As with your comment:

dt {
   background-color: black;
}
dt x {
   background-color: blue;
}

<dt>
<x>abc</x>
</dt>

edit2:

as with your 2nd comment:

dt x1 {
    width:25%;
}
dt x2 {
     width:75%;
     background-color: pink;
}

<x1>abc</x1><x2></x2>
Dorjan
@dorjan: Well, I got what I asked for but I was really looking for something else. I don't really want any text there at all, I just want to fill the background of the remainder of the dt box. Is there anyway to do that? I suspect the resulting 'dt x' box will not be what I want but just be the minimum to hold the text.
Mike D
In other words you want the container to be one colour for the text, and one colour for the blank area?The colour the whole dt the colour you want the remainder, and put the abc text in it's own container and colour that.That way you'll get a coloured left with the text and the remainder will be the other colour.Did I get what you meant?
Dorjan
@dorjan: I've already done as you suggested using 'span' but I was trying to do it as I described because a) it made more sense to me and b) as an exercise.
Mike D
so you want to create a 2nd box which is the remainder, and that be coloured? I really don't think you can do it that way, unless you do as I said about having the left and right boxes widths assigned via %.At least give me a vote up for answering all your questions though :P
Dorjan
ok, I owe a vote for answering the initial question. I don't think any of the other answers do what I want.
Mike D
heh, thanks. well create a new question and I hope you get what you want.
Dorjan