html - CSS - background image not showing properly -
no matter do, cannot image in .container div show when formatting css. top ~10% of image showing. if put img tag in html work perfectly. want format in css, not html, , in such away mobile-first compatible. want image centered , larger it's displaying. here html:
<!doctype html> <html lang="en-us"> <link rel="stylesheet" type="text/css" href="rabstyle.css"> <title>home</title> <meta charset = "utf-8"> <meta name="author" content="beth bennett"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <body> <header> <div class="icons"><p>icons</p></div> <ul class = "buttons"> <button id="login" type="button">log in</button> <button id="signup" type="button">sign up</button> </ul> </header> <div class="container"> <h2 class="intro">america's source for....</h2> <ul class="selector"> <li class="active"><a href="#">ds</a></li> <li><a href="#">cs</a></li> <li><a href="#">or</a></li> </ul> </div> </body> </html>
and here css:
* { box-sizing: border-box; margin: 0px; padding:0px; font-family: calibri, helvetica, sans-serif; } body { background-color:#ffffe0; } header { background-color: #aa0000; height: 75px; padding: 15px; } .icons{ float: left; margin-left: 100px; } .buttons { text-align: right; margin-right: 300px; } .container { background: url("homepageimagefinal.svg") no-repeat; background-position: center top; background-size: 1500px 1000px; }
add px
- doesn't have measurement unit - or 100%
width
, height
attributes (depending on needs)
i added background-size:cover
code , worked, image, because didn't provide svg:
.container { background: url("http://lorempixel.com/200/200/") no-repeat; background-size:cover; background-position: center top; height: 2000px; width: 2000px; }
Comments
Post a Comment