All Posts Tagged
Tag: ‘CSS’

Side By Side Divs

#container{width: 600px}
#content_left, #content_right{float: left;}
#content_left{width: 400px;}
#content_right{width: 200px;}
.clear{clear: both;}

<div id="container">
<div id="content_left">
</div>
<div id="content_right">
</div>
<div class="clear"></div>
</div>

#container{overflow:hidden;} ??????

Source

Read More

Use Variables In CSS

First: Add this to your main index’s styles.

<style type="text/css">@import ’style.php?c=css/styles.css’;</style>

Next, create a file named style.php with the following content.

<?PHP
/*
$foo=’bar’;
*/
header(‘content-type:text/css’);
header("Expires: ".gmdate("D, d M Y H:i:s", (time()+900)) . " GMT");
$c=$_GET['c'];
if(preg_match(‘/\//’,$c) or !preg_match(‘/.css/’,$c))
{
die(‘only local CSS files allowed!’);
}
$css=load($c);
if($css==”)
{
die(‘File not Found, sorry!’);
}
preg_match_all("/\\$(\w+).*=.*\’(.*)\’/",$css,$constants);
for($i=0;$i<sizeof($constants[1]);$i++)
{
$css=preg_replace(‘/\\$’.$constants[1][$i].’/',$constants[2][$i],$css);
}
$css=preg_replace("/\\#.*=.*?;\s+/s",”,$css);

echo $css;
/*
Function load($file)
reads the content of the file that you send and returns it
*/
function load($filelocation)
{
if (file_exists($filelocation))
{
$newfile = fopen($filelocation,"r");
$file_content = …

Read More