Connecting Tech Pros Worldwide Help | Site Map

variable width background on inline elements

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 23rd, 2005, 09:34 PM
Nathan
Guest
 
Posts: n/a
Default variable width background on inline elements

While I realize what I am trying to accomplish requires a lot of css, I
don't see it being fully implemented without JS. I have provided an
example from the Trac system that provides a progress meter. However I
want to accomplish the same thing but on elemnts on a web page where
the width is not defined, and the elements being effected are inline
like span tags.

My current thought on implentation:
I could use the offsetWidth, offsetHeight, offsetTop, offsetLeft on the
target inline element. Then dynamically create my structure in the same
place but use z-index to make sure it is positioned under the original
element. Does this sound workable or am I going down the wrong path?


<html>
<head>
<style>
.progress {float:left; border:1px solid #d7d7d7; width:40em;
max-width:80%}
.progress div {background: #bae0ba; height:1.2em}
</style>
</head>
<body>
<div class="progress">
<div style="width: 70%"></div>
</div>
</body>
</html>


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.