Make WordPress Core

Opened 10 years ago

Closed 9 years ago

Last modified 7 years ago

#30782 closed enhancement (maybelater)

Caption shortcode adds inline width style

Reported by: philbuchanan's profile philbuchanan Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.7
Component: Media Keywords:
Focuses: Cc:

Description

When using the caption shortcode WordPress adds an inline width style by default. Ideally this should not be set so theme developers can set widths in their stylesheets.

Change History (5)

#1 follow-up: @dd32
10 years ago

See #14380 for the history of the width style, and reasoning for still including the width in the new html5 support branch.

#2 in reply to: ↑ 1 ; follow-up: @philbuchanan
10 years ago

I understand the desire to force the caption to wrap, but isn't this something that should be done by theme developers? As it stands, it's very difficult to override this inline style in a themes stylesheet.

#3 in reply to: ↑ 2 @nacin
10 years ago

  • Version changed from 4.1 to 3.7

Replying to philbuchanan:

I understand the desire to force the caption to wrap, but isn't this something that should be done by theme developers? As it stands, it's very difficult to override this inline style in a themes stylesheet.

It's also very difficult to force a caption to wrap in a theme without this inline style, since an image's width is determined by the user's actions, not the theme specifications.

Every time I look at this, I feel like despite having dedicated HTML elements (figure and figcaption), HTML itself is letting us down here. If someone can come up with a sane way to do this, from the perspective of the user, the theme developer, and the core developer, then I'm all ears.

#4 @miqrogroove
9 years ago

  • Component changed from Shortcodes to Media
  • Milestone Awaiting Review deleted
  • Resolution set to maybelater
  • Status changed from new to closed

No traction.

#5 @mor10
7 years ago

A new reason to get rid of the inline style, or at the very least allow theme authors to filter it out easily:

When using CSS Grid for layouts, the inline rule forces the cell holding the element to retain the full width of the inline rule. This cannot be overridden using regular CSS rules and breaks layouts using CSS Grid. As such this non-standard inclusion actively breaks modern layout modules and techniques.

Note: See TracTickets for help on using tickets.