-1

I am new to CSS. I have added the code in to make the image responsive, but when I switch to mobile view, the image is not adjusting.

Here is my css -

element.style {
width: 100%;
height: auto;
background-image: url(dummy/banner_wide.png);

Not sure what is wrong?

java11
  • 43
  • 1
  • 1
  • 5
  • 2
    You are complaining about the image not being responsive. You actually don't have an image, but a **background image**. – Wais Kamal Oct 08 '18 at 10:08
  • Possible duplicate of [Responsive css background images](https://stackoverflow.com/questions/12609110/responsive-css-background-images) – Mosh Feu Oct 08 '18 at 10:09
  • So how do I make a background image responsive? – java11 Oct 08 '18 at 10:10
  • Refer to that previous question: https://stackoverflow.com/questions/12609110/responsive-css-background-images – Marco Dal Zovo Oct 08 '18 at 10:11
  • Like i said, I am new to CSS. I didn't know it was due to the background-image. Thank you for the link but why give my post negative rating, due to a misunderstanding??? – java11 Oct 08 '18 at 10:16
  • I have seen other users who have posted the same question but got not negative rating. THIS IS UNFAIR!! Sort it out and remove the negative ratings. – java11 Oct 08 '18 at 11:56

1 Answers1

0

Did you add this in the head tag of html?

<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
wins999
  • 1,432
  • 1
  • 9
  • 10