Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replacing images with their alt text if mobile screen size

Tags:

html

jquery

css

E.g. I have a logo that when the screen size gets below 480px the images hides and its alt text is shown as a replacement.

I was wondering if there is a simple pure CSS solution or will I need to use jQuery?

like image 253
chris Avatar asked Nov 19 '25 21:11

chris


1 Answers

The only thing you can really do with CSS is use your standard image replacement technique for your desired breakpoint.

http://cssdeck.com/labs/0r7hlsnt

<h1>Meow</h1>
@media (min-width: 480px) {
  h1 {
    background: url(http://placekitten.com/400/200) no-repeat;
    height: 200px;
    text-indent: -100em;
  }
}

Any image replacement technique will do.

like image 102
cimmanon Avatar answered Nov 21 '25 12:11

cimmanon