PHP 更新 CSS

PHP to update CSS

我需要根据 section_name 更新 css。如果部分是 Featured css 将是 right:0 如果 section_name 是 Latest css 将是 left:0 我怎样才能将一块 php 注入到 css 中?

<img src="square-009.jpg" style="width:300px; height:355px; position: fixed; z-index:9; right:0;" />

section_name 变量已被定义,它作为

工作
<?php echo $section['section_name']; ?>

只需使用 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;
}

然后动态填充 class:

<img src="square-009.jpg" class="<?php echo $section['section_name']; ?>" />