Ask Your Question
0

Can I set an image to be Max-Width=100% ?

asked 2015-08-23 23:39:47 +0200

updated 2015-08-23 23:40:43 +0200

I have a simple Writer document with an image as a banner. I commonly export the file to both PDF, and HTML, for easy viewing online.

When the document is exported to HTML, the size of the banner is fixed in the outputted HTML. I've tried to set the size of the image to be relative instead of fixed, but it still comes out with a set size in the HTML, instead of something responsive.

Is there a way to set the size of the image, in the output, to be max-width:100% ?

edit retag flag offensive close merge delete

Comments

What do you want to achieve with max-width:100% ?

max-width do not belong to the valid attributes of the img-element. http://www.w3.org/TR/html5/embedded-c...

Regina gravatar imageRegina ( 2015-08-24 11:28:10 +0200 )edit

Setting a CSS style for "max-width:100%" that applies to a specific image, or even all images, will make the images responsive and shrink to fix on a smaller screen, such as a smartphone. It works well when I add it by hand, I am just looking for a way to set it as a property for the image or document as a whole, so that I do not need to re-update it by hand after each export.

Example is at:

http://www.knightrealms.com/documents...

GJSchaller gravatar imageGJSchaller ( 2015-08-24 17:51:31 +0200 )edit

Setting a CSS style for "max-width:100%" that applies to a specific image, or even all images, will make the images responsive and shrink to fix on a smaller screen, such as a smartphone. It works well when I add it by hand, I am just looking for a way to set it as a property for the image or document as a whole, so that I do not need to re-update it by hand after each export.

GJSchaller gravatar imageGJSchaller ( 2015-08-24 17:51:47 +0200 )edit

Example is at: http://www.knightrealms.com/documents... The image at the top has had "max-width:100%" added to the style manually, and it resizes properly on a phone now.

GJSchaller gravatar imageGJSchaller ( 2015-08-24 17:52:28 +0200 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2015-08-24 19:15:39 +0200

Regina gravatar image

No there is no way to set max-width attribute. LibreOffice does not support style attribute on img-element. You should look for a better html authoring tool.

edit flag offensive delete link more

Comments

Ultimately, HTML is a side benefit, and not the main goal of the document. That being said, I think I have a solution in using a custom export template with Writer2xhtml, which should do the trick - I can add the style to the header on export.

GJSchaller gravatar imageGJSchaller ( 2015-08-25 16:13:13 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-08-23 23:39:47 +0200

Seen: 141 times

Last updated: Aug 24 '15