0

I have css file like this

    .mask {
        display: none;
    }

    #mask.loading {
            display: block;
            width: 100%;
            height: 100%;
            position: absolute;
            z-index: 1000;
            background-image: url('/icon.gif')
            background-position: center;
            background-repeat: no-repeat;
        }
    table.loading {
            opacity: .5;
}

And I want to show icon until table loads so I'm calling it like

$('#tableDisplay,#mask').addClass('loading');
$('#tableDisplay,#mask').removeClass('loading');

And in my html I added as

<div id="mask"></div>
<table id="tableDisplay">
</table>

And when I load page I can see table opaque but I do not see icon and my icon file is in same dir as css file

2 Answers 2

2

With your use of:

background-image: url('/icon.gif')

The slash is telling it to look in the web-root for the icon ... Remove the slash or give the full path IE

background-image: url('icon.gif')

background-image: url('/your/path/to/css/icon.gif')

This should also be apparent when you look in your console and see the 404 for the icon, you'll see the directory that the CSS file is "trying" to find icon.gif in

Sign up to request clarification or add additional context in comments.

Comments

1

Your first CSS rule has a class selector but it should be an ID:

#mask {  /* instead of .mask */
    display: none;
}

And your icon URL contains a slash which shouldn't be there if the icon is in the same directory:

background-image: url('icon.gif');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.