如果图像比浏览器的宽度宽,我希望裁剪图像而不是调整它的大小。不应该有水平滚动条。 只有CSS的解决方案是首选的,但PHP是可以接受的,JS不太可取,但仍然很受欢迎。使用背景图像并不理想。 ? browser width and cover photo must retain the center of cropped image 此代码块给出了我尝试过的内容,但可能没有太大帮助: .banner-container{ position: relative;
navbar-expand-md fixed-top justify-content-center" style="background: rgba(0,0,0,0.7); color: white;">Promotional bannertext goes here promotional banner text goes here promotional banner text goes here</nav>