diff options
| author | 时舟 <hi@sizau.com> | 2020-04-10 19:09:03 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-10 19:09:03 +0800 |
| commit | 597d43ad0c06ea2664e2e9832aa25311a3e16a86 (patch) | |
| tree | 6b5e336dc0e9d0ce918d864150d68b0e8103078d | |
| parent | cc6d146981eab5fd389308b9e621503f4719f3df (diff) | |
🧹 Fix: 修复背景图片不居中的问题
将background-position:center;移动到正确的位置
| -rw-r--r-- | includes/header.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/includes/header.php b/includes/header.php index 2d4728b..c38fb55 100644 --- a/includes/header.php +++ b/includes/header.php @@ -124,11 +124,11 @@ <header> <!-- Banner --> <?php if($this->is('post') || $this->is('page')): ?> - <div role="banner" class="index-banner" style="background-position:center;<?php if($this->fields->banner && $this->fields->banner=!''): ?>background:url('<?php $this->fields->banner(); ?>') no-repeat;<?php else: ?>background-color:#f1f1f1;<?php endif; ?>height:<?php $this->options->bannerHeight(); ?>vh;background-size:cover;"> + <div role="banner" class="index-banner" style="<?php if($this->fields->banner && $this->fields->banner=!''): ?>background:url('<?php $this->fields->banner(); ?>') no-repeat;<?php else: ?>background-color:#f1f1f1;<?php endif; ?>height:<?php $this->options->bannerHeight(); ?>vh;background-size:cover;background-position:center;"> <?php elseif($this->is('archive')): ?> - <div role="banner" class="index-banner" style="height:<?php $this->options->bannerHeight(); ?>vh;background-position:center;<?php if($this->options->bannerUrl!=''): echo $this->options->bannerUrl(); endif; ?>"> + <div role="banner" class="index-banner" style="height:<?php $this->options->bannerHeight(); ?>vh;<?php if($this->options->bannerUrl!=''): echo $this->options->bannerUrl(); endif; ?>"> <?php else: ?> - <div role="banner" class="index-banner" style="background-position:center;background:url('<?php $this->options->bannerUrl(); ?>') no-repeat;height:<?php $this->options->bannerHeight(); ?>vh;background-size:cover;"> + <div role="banner" class="index-banner" style="background:url('<?php $this->options->bannerUrl(); ?>') no-repeat;height:<?php $this->options->bannerHeight(); ?>vh;background-size:cover;background-position:center;"> <?php endif; ?> <!-- 遮罩 --> <div class="banner-mask"<?php if($this->is('post') || $this->is('page')):?><?php if($this->fields->banner==''):?> style="background:rgba(0,0,0,0)!important"<?php endif;?><?php endif; ?><?php if($this->is('index')):?><?php if($this->options->bannerUrl && $this->options->bannerUrl=!''): ?><?php else:?> style="background:rgba(0,0,0,0)!important"<?php endif;?><?php endif;?>> @@ -164,4 +164,4 @@ </div> </div> </div> - </header>
\ No newline at end of file + </header> |
