Jump to:

23364 Posts in 18125 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » css vs php to resize image as percent rather than pixels

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1312 Views
  • honeybunny
    Avatar
    Community Member
    79 Posts

    css vs php to resize image as percent rather than pixels Link to this post

    The only way I know to make an image re-size with the window is to use percent rather than pixels when setting the image size, but the default in the SS editor is pixels. Assigning a class to img in the css so that whenever the class is called the image size will be a set percentage will work, but I'm not sure if this is best approach. Am I being lazy and choosing the easiest option or should I be looking to set a default in the php?

    In my mind php should be used to define the foundation or structure of the site rather than the styling, yet it can be easily used to output content to a set style. (font color is the first example that comes to mind, though I would imagine it wouldn't be hard to set an image size) Is one better than the other or am I just thinking like a designer rather than a developer?

    HB

  • zenmonkey
    Avatar
    Community Member
    527 Posts

    Re: css vs php to resize image as percent rather than pixels Link to this post

    Take a look at media queries, because you could have SS build out the various sizes for your image and have the template load them correct sized one based on media queries

    1312 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.