1 回答

TA贡献1876条经验 获得超7个赞
首先创建动态类并在类中设置背景图像,然后在选项标签中应用类
<div class="form-group col-md-6">
<label for="inputtype">Game Type</label>
<select class="custom-select mr-md-2" name="image_file">
<option selected></option>
<?php foreach($games as $image): ?>
<script>
.image-option<?php echo $image->image_path(); ?>{
background-image: '<?php echo $image->image_path(); ?>';
width:"40";
height="40";
}
</script>
<option class='image-option<?php echo $image->image_path(); ?>' value="<?php echo $image->region ?>"></option>
<?php endforeach; ?>
</select>
</div>
- 1 回答
- 0 关注
- 171 浏览
添加回答
举报