calculating width

M

mpayne

I have a span that has a width of 25%. I want to use that span as the
top of a dialog box that has rounded corners. So, the span itself is
broken up into 3 smaller spans, one for the left and right corner
images, and one that stretches in between.

<span id="dialogTop" style="{width:25%;}">
<span id="dialogTopLeft" style="{width:6px;}"></span>
<span id="dialogTopMiddle" style="{width:(25% - 12px ???);}"></span>
<span id="dialogTopRight" style="{width:6px;}"></span>
</span>

I know that the left and right spans need to be 6px each. What I need
to do is define the width of the middle bit as being 25% - 12px. Is
this at all possible?

Thanks
Martin
 
R

RobB

I have a span that has a width of 25%. I want to use that span as the
top of a dialog box that has rounded corners. So, the span itself is
broken up into 3 smaller spans, one for the left and right corner
images, and one that stretches in between.

<span id="dialogTop" style="{width:25%;}">
<span id="dialogTopLeft" style="{width:6px;}"></span>
<span id="dialogTopMiddle" style="{width:(25% - 12px
???);}"> said:
<span id="dialogTopRight" style="{width:6px;}"></span>
</span>

I know that the left and right spans need to be 6px each. What I need
to do is define the width of the middle bit as being 25% - 12px. Is
this at all possible?

Thanks
Martin

Really a CSS, not a JavaScript, question. Might want to brush up on
inline (HTML) CSS notation first:
<span id="dialogTop" style="width:25%;">

Curly braces belong in HTML <style></style> blocks.

http://www.w3.org/TR/REC-html40/present/styles.html#h-14.2.2

A span is an inline element; you really need a box-level element for
this.

http://www.vertexwerks.com/tests/sidebox/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top