HTML/CSS - Automatically set height width from background image? -
Long time ... I do not think it's possible, but I'm shocked before!
I tag anchor tags, all of which are background images, all 300px wide but their height is all the difference, is it really set to do without typing altitude? Is it to set the dimensions of BG URL?
Thank you!
I do not think people understand - my mistake is to hurry the question.
Here is the code as an example:
# ago -1 {width: 300px; Height: 410px; Background: url ('/ image-1.jpg');} # East -2 {width: 300px; Height: 420px; Background: url ('/ image-2.jpg');} # Pre-3 {width: 300px; Height: 430px; Background: url ('/ image-3.jpg');} # Pre-4 {width: 300px; Height: 440px; Background: url ('/ image-3.jpg');} & lt; A href = "#" id = "ex-1" & gt; & Lt; / A & gt; & Lt; A href = "#" id = "ex-2" & gt; & Lt; / A & gt; & Lt; A href = "#" id = "pre-3" & gt; & Lt; / A & gt; & Lt; A href = "#" id = "ex-4" & gt; & Lt; / A & gt; I do not want to set the height, and it automatically sets itself using CSS. I do not want to use the image tag.
I was not sure that it was possible, I do not believe.
Thanks
An easy way to do this is to type this image To hide it and then to hide it I used the visibility: hidden
I saw that you & lt; Img & gt; do not want to use the tag but the image here is hidden and it takes place.
& lt; A href = "#" & gt; & Lt; Img src = "http://placekitten.com/300/301" / & gt; AA & lt; / A & gt; and apply CSS
a {display: block; Background Image: URL ('http://placekitten.com/300/301'); Width: 100px; Height: auto; } IMG {Visibility: hidden; }
Comments
Post a Comment