Edgewall Software
Modify

Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#11154 closed defect (worksforme)

Set a css max-width on image attachments for tickets

Reported by: kcerny@… Owned by:
Priority: low Milestone:
Component: wiki system Version: 1.0
Severity: normal Keywords: css image
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Images that are wider than the ticket's description div overflow past the size of the containing div, as in the image below: Current behavior of trac

This can be rectified with a small change to htdocs/css/ticket.css by adding the following:

#ticket .description IMG {
 max-width: 100%;
}

The end result: Same ticket after max-width css applied

Attachments (2)

overflow.png (28.6 KB ) - added by kcerny@… 11 years ago.
Current behavior of trac
constrained.png (46.3 KB ) - added by kcerny@… 11 years ago.
Same ticket after max-width css applied

Download all attachments as: .zip

Change History (11)

by kcerny@…, 11 years ago

Attachment: overflow.png added

Current behavior of trac

by kcerny@…, 11 years ago

Attachment: constrained.png added

Same ticket after max-width css applied

comment:1 by kcerny@…, 11 years ago

Upon further investigation, it might be better to add max-width: 100% to the img {} stylesheet rule in htdocs/css/trac.css instead.

comment:2 by Ryan J Ollos <ryan.j.ollos@…>, 11 years ago

Cc: ryan.j.ollos@… added

Adding the 100% argument to the image macro produces the same result. With that argument, width=100% is added as an attribute of the img element. The code is here.

Here is an example:

[[Image(overflow.png,100%)]]

Current behavior of trac

I suppose it could make sense to set the max-width to 100% by default.

Last edited 10 years ago by Ryan J Ollos (previous) (diff)

comment:3 by Peter Suter, 10 years ago

Component: generalwiki system
Keywords: image added
Milestone: unscheduled
Priority: normallow

See also #11116 for adjusting the margin defaults.

comment:4 by anonymous, 10 years ago

Bump, please set max-width: 100%

comment:5 by Ryan J Ollos, 10 years ago

You can set max-width to 100% using a custom stylesheet: TracInterfaceCustomization#SiteAppearance. As mentioned in comment:2, you can also use the 100% argument to the ImageMacro.

I don't see anything that needs to be done for this ticket, so I propose we close it as worksforme.

comment:6 by kcerny@…, 10 years ago

What's the harm in setting a max-width? Why so quick to close the ticket just because there is a workaround?

The suggestion in comment:5 does nothing to address the original issue this ticket was reported for.

comment:7 by Ryan J Ollos, 10 years ago

Resolution: worksforme
Status: newclosed

You can use the 100% argument to ImageMacro to set the width to 100%. [[Image(...,100%)]]. See comment:2 as well.

comment:8 by Ryan J Ollos, 10 years ago

Cc: ryan.j.ollos@… removed
Milestone: unscheduled

comment:9 by Ryan J Ollos, 10 years ago

Please do not reopen tickets. If another Trac developer disagrees with anything I've stated or has another approach they are welcome to reopen tickets. You've been provided with solutions to your issue. I don't think we will change the behavior because it would introduce inconsistencies with older versions of Trac.

Version 0, edited 10 years ago by Ryan J Ollos (next)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.