Php WP:内联样式背景图像-不适用于Safari 6.0及以下版本
我将帖子/页面特色图片作为内联背景图片 下面的代码在大多数浏览器上都能很好地工作,但在Safari 6.0及以下版本上则不行 在Safari 6.0上,内联样式跳过Php WP:内联样式背景图像-不适用于Safari 6.0及以下版本,php,wordpress,safari,inline-styles,Php,Wordpress,Safari,Inline Styles,我将帖子/页面特色图片作为内联背景图片 下面的代码在大多数浏览器上都能很好地工作,但在Safari 6.0及以下版本上则不行 在Safari 6.0上,内联样式跳过background:url('xxx')不重复滚动xxx/cover并直接转到最小高度:(…) 背景附件也不会显示在DOM中 单个项目站点的示例:。试用ex.Chrome和Safari 6.0。 这是我针对单个页面的PHP代码-在其他页面上几乎相同 <?php if(is_single()):
background:url('xxx')不重复滚动xxx/cover
并直接转到最小高度:(…)
背景附件
也不会显示在DOM中
单个项目站点的示例:。试用ex.Chrome和Safari 6.0。
这是我针对单个页面的PHP代码-在其他页面上几乎相同
<?php if(is_single()):
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
?>
<?php if ( has_post_thumbnail() ) { ?>
<div class="featured_image" style="background: url('<?php echo $image[0]; ?>') no-repeat scroll <?php the_field('bg_vert_posisjon'); ?> <?php the_field('bg_hor_posisjon'); ?> / cover; min-height: 700px; position: relative; width: 100%; background-attachment: <?php the_field('bg_oppforsel'); ?>">
<?php } else { ?>
<div class="no_feature_image"></div>
<?php } ?>
你的问题似乎出在
background: url('http://skarpsinn.no/wp-content/uploads/2014/04/banner_oeva.png') no-repeat scroll center center / cover
如果卸下/cover
并将其放在自己的行上,它应该可以工作。风格将是:
background: url('http://skarpsinn.no/wp-content/uploads/2014/04/banner_oeva.png') no-repeat scroll center center;
min-height: 700px;
position: relative;
width: 100%;
background-attachment: initial;
background-size: cover;
(这样做对我在sarafi 5.1.7上起到了作用)情况是整个背景:url()
在Safari 6.0(及以下版本)上消失了。在Safari 5.1.7上背景:url()
仍然存在,但由于/cover
而无法工作。