Page MenuHomePhabricator

Wikidata page banner should make use of object-position
Open, LowPublic

Description

Much of what wikidata page banner does is now possible with much simpler CSS

.wpb-topbanner .wpb-banner-image {
width: 100%;
height: auto;
max-height: 200px;
object-fit: cover;
min-height: 120px;
}

Then instead of applying transform and margin offsets on a parent item, we should be able to use object-position, for which the values should be determinable based on the difference in the aspect ratios before and after scaling, with initial being center center

We should also add width/height attributes to the initial banner image being served, as this provides aspect ratio to browsers to base their initial layout'ing on.

Event Timeline

One problem with working on this is that I lack a good set of images and banner function parser function examples, which demonstrate all the different modes. Do you have some old cases lying around @Jdlrobson ?

Change 925014 had a related patch set uploaded (by TheDJ; author: TheDJ):

[mediawiki/extensions/WikidataPageBanner@master] Initial cleanup of CSS

https://gerrit.wikimedia.org/r/925014

LGoto triaged this task as Low priority.Jun 8 2023, 5:21 PM
LGoto moved this task from Incoming to Groomed on the Web-Team-Backlog board.

Change 925014 merged by jenkins-bot:

[mediawiki/extensions/WikidataPageBanner@master] Initial cleanup of CSS

https://gerrit.wikimedia.org/r/925014