php 显示宽度不够,php – 增加标题的宽度

我的网站是www.rosstheexplorer.com

我希望标题图像在整个页面上伸展,但我不希望任何字母被“Ross The Explorer”文本删除.

在customer-header.php中,我有这个代码

*/

function penscratch_custom_header_setup() {

add_theme_support( 'custom-header', apply_filters( 'penscratch_custom_header_args', array(

'default-image' => '',

'default-text-color' => '666666',

'width' => 937,

'height' => 300,

'flex-height' => true,

'wp-head-callback' => 'penscratch_header_style',

'admin-head-callback' => 'penscratch_admin_header_style',

'admin-preview-callback' => 'penscratch_admin_header_image',

) ) );

}

我变了

'width' => 937,

'width' = 100%,

3天后,我设法修复了损坏.

我有两个标题图像,一个用于移动设备.我有与header.php和附加CSS中的标题图像相关的代码.

在header.php中,代码是

Cover-Photo-6-2.jpg

Cover-Photo-Mobile-Test.jpg

在其他CSS中代码是

@media screen and (min-width: 661px) {

.mobile-header-img {

display: none;

width: 100%;

}

}

@media screen and (max-width: 660px) {

.header-img {

display: none;

}

}

我不确定是否需要在php文件或附加CSS中进行修改.在我的最后一次实验给我带来了重大问题之后,我不愿意再进行自己的实验了.有人可以提供一些指导吗?

根据以下评论,我的代码现在如下

额外的CSS

@media screen and (min-width: 661px) {

.mobile-header-img {

display: none;

width: 100%;

max-width: none;

}

}

@media screen and (max-width: 660px) {

.header-img {

display: none;

width: 100%;

max-width: none;

}

}

header.php文件

Cover-Photo-6-2.jpg

Cover-Photo-Mobile-Test.jpg

这实现了我的目标直到浏览器的宽度大于1300px,然后空白区域开始出现在标题的右侧.

解决方法:

您的图像不会扩展到页面的整个宽度,因为它们位于具有最大宽度的包装器内.您可以将图像带到包装器之外(见下文).您还可以对图像应用position:absolute,但这会导致另外一组问题.

Cover-Photo-6-2.jpg

Cover-Photo-Mobile-Test.jpg

您还必须添加此CSS以强制图像扩展超出其自然大小,但这会开始模糊图像.

.header img {

max-width: none;

width: 100%;

}

标签:php,css,wordpress,header

来源: https://codeday.me/bug/20191003/1848334.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值