- This topic is empty.
-
AuthorPosts
-
August 23, 2017 at 6:12 pm #259436
twbarton
ParticipantI am creating a book review site built on ghost (I know not wordpress, hope I can still get some help) I’m using a theme I purchased. The problem I’m having is that not all the images are the same size, pulled from amazon, so I have been resizing each one to the same size. The images are vertical rectangles instead of horizontally rectangular which is part of the issue as the template expects the latter.
I have been playing with the css but the issue is that on the main page on the desktop and mobile the images are being stretched and clipped.
Any help would be appreciated.
http://twbarton.com
The site is private. the password is ciruma794August 23, 2017 at 6:14 pm #259437twbarton
ParticipantI’m open to any design thoughts as well if anyone thinks there is a better way to accomplish my goal.
Ty
August 23, 2017 at 10:18 pm #259438Beverleyh
ParticipantYou’re more likely to receive help if you provide a reduced demo of the problem for us to look at/tinker with in CodePen.
We don’t need to see your whole codebase. Just enough HTML and CSS to illustrate the problem with the image.
August 28, 2017 at 3:12 am #259510webinuse
ParticipantYeah, Beverleyh is right. I can not help you if I have to try to find your problem in your code.
August 28, 2017 at 1:11 pm #259525twbarton
ParticipantOf course, you’re correct. I’ll try to boil it down this evening and get a link posted.
Ty
August 28, 2017 at 5:10 pm #259546twbarton
ParticipantAugust 28, 2017 at 10:36 pm #259549Beverleyh
ParticipantSorry – most folks haven’t got the free time to filter through a 800+ line CSS file.
We just need the bare basics of HTML and CSS to illustrate the actual problem. If you can go through the process of cutting it all back to a dozen or so lines, that will make things much easier and less overwhelming for potential helpers.
That said, try
background-size: cover;
on the div holding the image.August 29, 2017 at 1:33 pm #259580twbarton
ParticipantThanks, Beverleyh, I cut down the css. It was originally set as cover and that had a worse effect.
Ty
August 29, 2017 at 1:42 pm #259584twbarton
ParticipantI also removed my changes so it looks like the original code minus the sidebar.
Ty
August 29, 2017 at 2:09 pm #259586Beverleyh
Participantbackground-size: cover;
orbackground-size: contain;
would the logical choices here.August 29, 2017 at 3:06 pm #259597twbarton
ParticipantThank you for your reply. It is already set to cover and I have tried contain but both cause the image to be cropped which is the whole issue. I’m trying to find a way to present the book covers without cropping or distorting them.
Ty
August 29, 2017 at 10:13 pm #259603Beverleyh
ParticipantYou are mistaken. ‘contain’ doesn’t crop or distort the image; It will fit the height of the image down into the available space and leave a gap at each side (with ‘no-repeat’ in place).
October 23, 2017 at 1:00 pm #259515masonwongcs
ParticipantAll you need is adjusting the background-size and background-position attribute. Just overwrite the class with this:
div.featured-media{ width: 100%; background-size: 60% auto; //Adjust percentage based on your requirement background-position: center; }
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.