
CSS
- 34 ответа
- 0 вопросов
13
Вклад в тег
// allow SVG uploads
add_filter('upload_mimes', 'custom_upload_mimes');
function custom_upload_mimes ( $existing_mimes=array() ) {
$existing_mimes['svg'] = 'image/svg+xml';
return $existing_mimes;
}
function fix_svg() {
echo '<style type="text/css">
.attachment-266x266, .thumbnail img {
width: 100% !important;
height: auto !important;
}
</style>';
}
add_action('admin_head', 'fix_svg');
<div class="img-block" style="background-image: url(something.img)">
<img href="something.img" />
</div>
<div class="img-block" style="background-image: url(something.img)">
</div>
.img-block {
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.img-block img {
opacity: 0;
}
<img>
можно совсем удалить.<img>
вставлять один и тот же файл something.img, этим можно контролировать линейные размеры блока <div>
, не указывая его размер в стилях.