1

I am currently working on an e-mail design. As far as I learned, I need to write css codes inside my html tags. But now there is such a problem, how can I use the media tag between the html tags.I need to embed the media tag in html

My trial codes:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="example">
        Lorem ipsum dolor sit amet consectetur, adipisicing elit. Aut provident labore similique veniam, ipsam officiis optio, eius excepturi ducimus vitae corrupti amet! Vitae repellat velit culpa libero facere accusamus assumenda.
    </div>

    <style>
        .example{
            color: blue;
        }

        @media only screen and (max-width: 600px){
            .example{
                color: red;
            }
        }
    </style>
</body>
</html>
imdvlt39
  • 29
  • 4

1 Answers1

0

@media at-rules and media queries cannot exist in inline style attributes as they can only contain property: value declarations.

Read more: Is it possible to put CSS @media rules inline?