- This topic is empty.
-
AuthorPosts
-
April 13, 2015 at 7:47 am #200337
lesleelanglands
ParticipantHi there,
I am working on converting a site to be responsive and it is quite heavy in images (each page has a different header image). Is there a way with css that I can make the images resize in my soon to be fluid layout?
Thanks!
LesleeApril 13, 2015 at 7:58 am #200338Paulie_D
MemberIt’s a very broad question and without code it’s hard to help
A quick google for “responsive images” will point you in the right direction.
April 13, 2015 at 8:05 am #200340lesleelanglands
ParticipantThanks for responding…
Here is the html
And the css
#header_content {
position: relative;
z-index: 35;
height: 137px;
width: 100%;
top: 28px;
left: 0px;
margin-left:auto;
margin-right:auto;
padding-left: 15%;
float: none;
clear: none;
}April 13, 2015 at 8:07 am #200341lesleelanglands
ParticipantNot sure how to get the html to show…
April 13, 2015 at 8:13 am #200342lesleelanglands
ParticipantSorry I dont have a codepen account..
Making my image 100% width resizes it.
Sorry I am a new to the responsive design. I am just figuring out the best way to layout my site again, which previously used absolute positioning.
April 16, 2015 at 6:46 am #200550lesleelanglands
ParticipantCan anyone help on this?
April 16, 2015 at 6:50 am #200556Paulie_D
MemberSorry I dont have a codepen account..
You don’t need an account…
Just make the demo you need with enough code to actually show the problem…hit the save button at the top and then copy the link and paste it here.
April 16, 2015 at 11:23 am #200594cssgirl
ParticipantInstead of using width: 100%, have you tried using max-width: 100%? Than the images shouldn’t ever be wider than the width of the browser/device (or it’s container).
But do note, if the image had a height attached you will have to set the height to auto or some other override so the ratio won’t get wonky on resize of the page… (e.g the height will stay fixed to whatever is set in the HTML but the width will be flexible).
April 17, 2015 at 9:41 pm #200663carinlynchin
Participantif you want responsive maybe you should do media queries.
April 20, 2015 at 2:50 pm #200821gvinson
ParticipantMoving a fixed width site to a responsive one can be quite daunting for sure. What I would recommend would be to set the max-width of the image to 100% and remove the height.
If you need a specified height, create a div that is the desired height/width and set the image as a background image for that div. Play around with background positioning and background sizing properties to get it to flow right.
After that, media queries are the next big thing to consider.
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.