html - How to make image scale without media css -
i have image name plate (past champions) plague , looks decent on screens except iphone portrait, seems cut off.
anyway make scale without media css?
here home page. http://www51.myfantasyleague.com/2017/home/61106#0
original code still in css
#championship_plaque h2 { background: rgba(0, 0, 0, 0) url( "http://dagrafixdesigns.com/images/2008/da_2017/da_pro16/plaquetitle_glass.png" ) no-repeat scroll center center !important; border: 0 none; margin-left: 25px; text-indent: -9999px; } tried code no luck
#championship_plaque h2 { background: rgba(0, 0, 0, 0) url( "http://dagrafixdesigns.com/images/2008/da_2017/da_pro16/plaquetitle_glass.png" ) no-repeat scroll center center !important; background-position: 70% 0; background-repeat: no-repeat; background-size: cover; padding-bottom: 20px; padding-top: 20px; } desktop:
mobile:
i guess can use media call switch new image size screen if else fails, want see if can done way first. thx
in second example you're duplicating property values using shorthand background property !important overriding them afterwards. recommend using longhand properties when want clear what's going on.
what want background-size: contain - automatically downscales image it's 100% visible in parent container. want remove background-color: black:
this rule i've got works me:
#championship_plaque h2 { background-image: url("http://dagrafixdesigns.com/images/2008/da_2017/da_pro16/plaquetitle_glass.png"); background-size: contain; background-repeat: no-repeat; background-position: center center; } note if want hide text there's better approach text-indent: -9999px, instead consider using combination:
user-select: none; color: #00000000; /* hex rrggbbaa, aa=00 means 0% opacity, text invisible */ 

Comments
Post a Comment