Santa make CSS fully Programmable
Christmas is around 10 days away, here is my wish to Santa.
Dear Santa,
Sometimes I think why is Cascading Style Sheet(CSS) not fully programmable like other programming languages? I'll be glad if this Christmas you can gift us (whole web designing and programming fraternity) something like CSS 2.0 or CSS++. That will largely simplify the way we do CSS. I hope you devise someting that will make all the webpages we develop look same in all the browers though it is Firefox, Internet Explorer, Opera, Netscape and we don't ever have to use
I also wish if this:
#left_side {
margin-top: 10px;
float: left;
width: 200px;
background: #FCD8A8 url('images/side_bg.gif') bottom left repeat-x;
}
#right_side {
margin-top: 10px;
float: right;
width: 200px; /*16 by default */
right:17px;
background: #FCD8A8 url('images/side_bg.gif') bottom left repeat-x;
}
Could be done as this:
var margin_top=10px;
#left_side {
margin-top: margin_top;
float: left;
width: 200px;
background: #FCD8A8 url('images/side_bg.gif') bottom left repeat-x;
}
if(margin_top=="10px"){
#right_side {
margin-top: margin_top;
float: right;
width: 200px; /*16 by default */
right:17px;
background: #FCD8A8 url('images/side_bg.gif') bottom left repeat-x;
}
}//if close
else {
#right_side {
margin-top: 12px;
float: right;
width: 200px; /*16 by default */
right:17px;
background: #FCD8A8 url('images/side_bg.gif') bottom left repeat-x;
}
}//else close
If we could also use loops:
for each(#*_sidebar)
{
widht= 200px;
}
for($i=0;$i<5 i="" span="">
{
#*_sidebar=width+i; // I know it doesn't make sense, just using loop
}
And last but not the lease if we could get the screen size and program just using CSS.
var screen_size=get_screensize();
if(screen_size.screen_widht=1027){
#header{
background: #FCD8A8 url('images/header_bg_1024.jpg);
}
}//if close
else if(screen_size.screen_widht=800){
#header{
background: #FCD8A8 url('images/header_bg_800.jpg);
}
}//else if close
else{
#header{
background: #FCD8A8 url('images/header_bg_freesize.jpg);
}
}//else close
Hope Santa you listen to us.
The main message is if there was a language may be CSS 2.0 or CSS++ with use of which we could use variables, conditions, loops, objects etc in CSS all features of a standard programming language and we could do it without any effect to our current CSS code life would have been far easeier. Hope somebody will listen and respond, add on your CSS 2.0 or CSS++ facilities you want.
Geshan Manandhar.5>
Dear Santa,
Sometimes I think why is Cascading Style Sheet(CSS) not fully programmable like other programming languages? I'll be glad if this Christmas you can gift us (whole web designing and programming fraternity) something like CSS 2.0 or CSS++. That will largely simplify the way we do CSS. I hope you devise someting that will make all the webpages we develop look same in all the browers though it is Firefox, Internet Explorer, Opera, Netscape and we don't ever have to use
< !--[if IE] >
< type="text/css" media="all"> @import "/css/style_ie.css";< /style >
< ![endif]-- >.
I also wish if this:
#left_side {
margin-top: 10px;
float: left;
width: 200px;
background: #FCD8A8 url('images/side_bg.gif') bottom left repeat-x;
}
#right_side {
margin-top: 10px;
float: right;
width: 200px; /*16 by default */
right:17px;
background: #FCD8A8 url('images/side_bg.gif') bottom left repeat-x;
}
Could be done as this:
var margin_top=10px;
#left_side {
margin-top: margin_top;
float: left;
width: 200px;
background: #FCD8A8 url('images/side_bg.gif') bottom left repeat-x;
}
if(margin_top=="10px"){
#right_side {
margin-top: margin_top;
float: right;
width: 200px; /*16 by default */
right:17px;
background: #FCD8A8 url('images/side_bg.gif') bottom left repeat-x;
}
}//if close
else {
#right_side {
margin-top: 12px;
float: right;
width: 200px; /*16 by default */
right:17px;
background: #FCD8A8 url('images/side_bg.gif') bottom left repeat-x;
}
}//else close
If we could also use loops:
for each(#*_sidebar)
{
widht= 200px;
}
for($i=0;$i<5 i="" span="">
{
#*_sidebar=width+i; // I know it doesn't make sense, just using loop
}
And last but not the lease if we could get the screen size and program just using CSS.
var screen_size=get_screensize();
if(screen_size.screen_widht=1027){
#header{
background: #FCD8A8 url('images/header_bg_1024.jpg);
}
}//if close
else if(screen_size.screen_widht=800){
#header{
background: #FCD8A8 url('images/header_bg_800.jpg);
}
}//else if close
else{
#header{
background: #FCD8A8 url('images/header_bg_freesize.jpg);
}
}//else close
Hope Santa you listen to us.
The main message is if there was a language may be CSS 2.0 or CSS++ with use of which we could use variables, conditions, loops, objects etc in CSS all features of a standard programming language and we could do it without any effect to our current CSS code life would have been far easeier. Hope somebody will listen and respond, add on your CSS 2.0 or CSS++ facilities you want.
Geshan Manandhar.5>