html - placing object under other object in a responsive page -
i have responsive page has header container image , text change size when resizing browser window. code goes this:
<!doctype html> <html> <head> <title></title> <meta charset="utf-8" /> <script src="script.js"></script> <link href="style.css" rel="stylesheet" /> <link href="http://fonts.googleapis.com/css?family=bree+serif" rel="stylesheet" type="text/css"> </head> <body> <div id="header"> <img src="city.png" /> <span>weather website</span> </div> </body> </html>
and css following:
* { padding: 0; margin: 0; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } body { font-family: arial; font-size: 14px; } /*img { width: 100%; }*/ #header { text-align: center; background-color: #ededed; padding: 1em 0; } #header span { font-family: 'bree serif', serif; font-size: 2em; color: #414142; vertical-align: middle; margin-left: 2px; } #header img { vertical-align: middle; } @media screen , (max-width:600px) { #header img { width: 15%; } } @media screen , (max-width:380px) { #header span { font-size: 1.65em; } }
i want span below img after window size. how can accomplish it? thanks.
you can add display: block
span
element within media query:
https://jsfiddle.net/5b3b0srj/
@media screen , (max-width:600px) { #header span { display: block; } }
Comments
Post a Comment