I am working in a php
language . In my database there are normal image and a hover image . I know how to call it from the database but i don't know how to make class so that if i have 2 entries in my database for each ie normal image and hover image and by calling it from the db it will act as a 2 button image with the hover image because I have 2 rows
in my column
I have defined it in between head .
<style>
.n1{background:url(../images/no.png);
width:110px; height:29px;
float:left;
margin-top:6px
}
.n1:hover{
background:url(../images/no-h.png);
}
</style>
If you are using inline styles, then you can just use this:
<?php $var = 'no'; ?>
<style>
.n1{background:url(../images/<?php echo $var ?>.png);
width:110px; height:29px;
float:left;
margin-top:6px
}
.n1:hover{
background:url(../images/<?php echo $var ?>-h.png);
}
</style>
You can create dynamics CSS using the below
Define Content-Type on the top of your .css.php file:
<?
header('Content-Type: text/css');
// print out your php-driven css...
?>
and call the file like this ..
<link rel="stylesheet" type="text/css" media="screen" href="CSS_PATH/name-of-file.css.php">
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.