我希望 img 具有固定大小,例如 290x193,并且不会随着图像的实际宽度和高度而改变,我在 img 标签上尝试了内联 CSS,但它不起作用。是否有任何引导类用于此目的而不是定义 CSS?
这是我的代码:
<?php foreach($articles as $articl): ?>
<div class="col-md-6">
<a href="blog-single.php" class="blog-entry element-animate" data-animate-effect="fadeIn">
<img style="width: 290; height:193;" src="<?php echo BASE_URL . '/assets/images/' . $articl['image'] ?>" alt="Image placeholder">
<div class="blog-content-body">
<div class="post-meta">
<span class="category">Food</span>
<span class="mr-2"><?php echo date('F j, Y',strtotime($articl['entry_date'])) ?></span> •
<span class="ml-2"><span class="fa fa-comments"></span> 3</span><br>
<span class="mr-2">By: <?php echo $articl['name'].' '.$articl['last_name'] ?> </span>
</div>
<h2><?php echo $articl['title'] ?></h2>
<p><?php echo substr($articl['abstract'], 0, 80).'...' ?></p>
</div>
</a>
</div>
<?php endforeach;?>