Ethodax Ethodax - 4 months ago 30
CSS Question

CSS Image Resizing for subreddit theme

I am currently trying to use a subreddit theme and resize an image to be bigger/actual size of uploaded image.

Current code for the Logo is:

/* SUBEDDIT LOGO ADDON
----------------------*/
#header .pagename a {
width: 100px;
background: url(%%subredditlogo%%) left center/auto 50px
}


I am trying to scale image to be bigger with keeping aspect ratio.

Like I said this is on Reddit, so I can only interact with the subreddit stylesheet.




I have edited it some and played with it, I have gotten improvements, but not the full image to show.

Here is my current code:

/* SUBEDDIT LOGO ADDON
----------------------*/
#header .pagename a {
width: 300px;
background: url(%%subredditlogo%%) left center/auto 300px;
background-size:100% 200%;
background-repeat:no-repeat;
}


It has resized the width but I cant get the height to change. I have tired the:

left center/auto 300px;


but nothing, and also the

height: 100%;
height: auto;


Just looking to get it fixed now.

Answer

Try this:

background-image: url(%%subredditlogo%%);
background-position: left center;
background-size:cover;
background-repeat:no-repeat;

I believe you need to break out your "background" css into individual attributes in order for each attribute to work properly.