I need to update the css according to section_name. If section is Featured css would be right:0
and if section_name is Latest the css would be left:0
How can I inject a piece of php into css ?
<img src="square-009.jpg" style="width:300px; height:355px; position: fixed; z-index:9; right:0;" />
The section_name variable is already defined and it is working as
<?php echo $section['section_name']; ?>
Just use classes:
.Featured {
width:300px;
height:355px;
position:fixed;
z-index:9;
right:0;
}
.Latest {
width:300px;
height:355px;
position:fixed;
z-index:9;
left:0;
}
And then just populate the class dynamically:
<img src="square-009.jpg" class="<?php echo $section['section_name']; ?>" />