- This topic is empty.
-
AuthorPosts
-
December 13, 2016 at 11:26 pm #248973davidspryParticipant
I’m currently working on my website and I’m having some trouble with image resizing.
Images have a max-height of 60vh. If you open the website and adjust the height of the browser, you should see that working properly. However, it only works until the viewport width shrinks to roughly 500-600px. Beyond that point, the image becomes distorted rather than resizing automatically.
I can’t work out what’s overriding the automatic resizing function. Any help would be appreciated!
December 14, 2016 at 1:59 am #248975AsGYakimovParticipantOn line 245 of your css you have this:
@media (min-width: 780px) .content img { position: relative; left: 50%; transform: translateX(-50%); }
I think this is what breaks your design.
December 14, 2016 at 2:10 am #248976davidspryParticipantThanks for your suggestion. Sadly, removing that code doesn’t fix the problem. That just keeps the image horizontally centred at viewport widths above 780px.
December 14, 2016 at 2:43 am #248977AsGYakimovParticipantIf you remove it from the media query and put it as ‘normal’ style, it should work..
December 14, 2016 at 3:15 am #248979davidspryParticipantThat doesn’t work either. Moreover, I removed all of the media queries last night and the problem remained.
If it helps, there’s another gallery on the ‘Pictures’ page. Strangely, only the landscape oriented pictures are affected on that page. The portrait-oriented pictures scale correctly (picture 13/15, for instance) on that page, but not on the front page. Confusing!
December 14, 2016 at 9:44 am #248991bearheadParticipantThe problem is caused by width and height declarations being added to your images when the browser window goes below 780px. I assume this is because of some javascript on your website, but I haven’t been able to find the offending line.
A very dirty solution would be to add
!important
to
width: auto;
for yourimg
selector (line 173).December 14, 2016 at 5:40 pm #249017davidspryParticipantThanks, bearhead! That works.
I suspect I’ll have to stick with this solution because the image scaling that’s causing the distortion is apparently built-in to the website builder I’m using.
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.