Welcome visitor
* Login
* Register
It is currently September 20th, 2019, 9:29 am
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » HTML



Post new topic Reply to topic  [ 3 posts ] 
Author Message
  CSS using variables
PostPosted: December 3rd, 2009, 7:29 pm 

Posts: 15
Hi, does someone knows if CSS stylesheets can handle variable values? Because I want to dinamically set the apperance of my site. Any help is appreciated.


Top
 Profile  
 
  Re: CSS using variables
PostPosted: December 3rd, 2009, 8:33 pm 

Posts: 16
Although CSS uses not variable values, you can use javascript to change the style attributes to the elements on your website:
<style type="text/css">
#img1{width: 300px}
</style>
<img id="img1" src="z.jpg" />
Enter new width <input id="nw" />px <input type="button" value="resize" onclick="resizeImg();"/>
<script type="text/javascript">
  function resizeImg()
  {
    w=document.getElementById('nw').value;
    document.getElementById('img1').style.width=w+'px';
  }
</script>


Top
 Profile  
 
  Re: CSS using variables
PostPosted: December 4th, 2009, 8:24 am 
User avatar

Posts: 63
Also you can change the complete CSS stylesheet you are using:

http://www.scriptingok.com/forum/t5_1049-Random-CSS-each-time-page-is-loaded-or-reloaded


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

FORUMS » Client Side » HTML


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron