html - Why is my image not showing in CSS? -


i new css , learning it. looked through these forums in search of answer question yet nothing tried worked. here's code.

<html>   <head>     <link rel="stylesheet" type="text/css" href="css.css">   </head> <body>   <br>   <div>     <a href="http://www.google.com" class="boxa"> </a>   </div> </body> </html> 

here css:

.boxa {   display: block;   background:url(c:\users\sidworld\desktop\app-google-icon.png);   width: 512px;   height: 512px;   -webkit-transition:width 0.1s, height 0.1s, background-color 0.4s, -webkit-transform 0.5s;   transition:width 0.1s, height 0.1s, background-color 0.4s, transform 0.1s; }  .boxa:hover {   background:url(..\desktop\app-google-icon.png);   width:1024px;   height:1024px; } 

i'm new here please bear bad formatting. image on desktop , have checked it.

change

background: url(c:\users\sidworld\desktop\app-google-icon.png); 

to

background-image: url("/users/sidworld/desktop/app-google-icon.png"); 

never use \. backslash escape character, single \ doesn't mean think means.

windows has understood / years. if working locally, can safely use / in place of \ , more portable.

also, c: windows-only thing. try use relative paths if can, aka ./icon.png or ../images/icon.png retain portability.

finally, using background-image preferred here, since property setting. if define background elsewhere, might override image you've set!


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -