【发布时间】:2017-08-12 19:59:55
【问题描述】:
在朋友的网站上,我正在尝试帮助他正确显示索引页横幅。使用的主题是 Arcade Basic (Batovasan)
库中上传的图片为1920x500px(150dpi),生成的html代码为:
<header id="header">
<div class="title-card-wrapper">
<div class="title-card" style="height: 778px;">
<img class="header-img" src="http://www.example.com/wp-content/uploads/myHeader.jpg" alt="" style="position: absolute; left: -667px; top: 0px; right: auto; bottom: auto; width: auto; height: 100%;">
</div>
</div>
</header>
图像自动设置为放大并自动向左负位置...(请参阅http://www.tangoumois.com)
当前的css是
.title-card {
position: relative; }
.title-card-wrapper {
overflow: hidden; }
.title-card {
z-index: 1;
width: 100%;
display: table;
text-align: center; }
.title-card > img.header-img {
position: absolute;
z-index: 0;
left: -9999px;
max-width: none; }
在function.php中,有一个过滤器可以上传和调整图片大小
// Add a filter to bavotasan_header_image_width and bavotasan_header_image_height to change the width and height of your custom header.
add_theme_support( 'custom-header', array(
'header-text' => false,
'flex-height' => true,
'flex-width' => true,
'random-default' => false,
'width' => apply_filters( 'bavotasan_header_image_width', 1920 ),
'height' => apply_filters( 'bavotasan_header_image_height', 500 ),
) );
当我使用 Chrome Dev 检查时,我得到以下信息
如何正确设置横幅,没有这个负面位置..
【问题讨论】:
标签: css wordpress header banner