2014-09-12 55 views
-2

我有几个在JSP标签,如下转换JSP的风格标签为CSS条目

<style type="text/css"> 
    #mask { 
     display: none; 
     cursor: wait; 
     z-index: 99999; 
     position: absolute; 
     top: 0; 
     left: 0; 
     height: 100%; 
     width: 100%; 
     background-color: white; 
     filter: alpha(opacity=70); 
    } 
</style> 

<div id="mask"> 
    <div style="position: absolute; top : 300px; left : 550px; text-align : center; vertical-align: middle;font-family: arial,helvetica,verdana,sans-serif; color : red; font-size : 16px; font-weight : bold; text-decoration: underline;"> 
     <img src="<%=request.getContextPath()%>/images/progress.gif" /> 
     <br/>loading 
    </div> 
</div> 

当我试图把它们作为CSS项目,我没有得到正确的输出。

.busyDiv { 
    position: absolute; 
    top: 300px; 
    left: 550px; 
    text-align: center; 
    vertical-align: middle; 
    font-family: arial, helvetica, verdana, sans - serif; 
    color: red; 
    font-size: 16px; 
    font-weight: bold; 
    text-decoration: underline; 
} 

.busyStyle { 
    display: none; 
    cursor: wait; 
    z-index: 99999; 
    position: absolute; 
    top: 0; 
    left: 0; 
    height: 100 % ; 
    width: 100 % ; 
    background-color: white; 
    filter: alpha(opacity = 70); 
} 

我把他们当作

<style type="text/css" class="busyStyle"> 
    #mask {} 
</style> 

<div id="mask"> 
    <div class="busyDiv"> 
     <img src="<%=request.getContextPath()%>/images/progress.gif" /> 
     <br/>loading 
    </div> 
</div> 

当我使用上述CSS项,如预期的功能不工作?

我错过了什么吗? (它的工作原理,当我把这些标签,JSP,因为他们,但我想的样式分成CSS项)

+0

不要上课你的样式表,class class div class =“busyStyle”' – briansol 2014-09-12 15:09:06

+0

试过这个,但我的gif没有显示,因为我在css条目中定义了“busyDiv” – Techie 2014-09-12 15:19:08

+0

div应该归类作为“busyDiv”的权利?为什么“busyStyle”? – Techie 2014-09-12 15:19:42

回答

0

我为如下样式,使其在CSS工作

.hiddenDiv { 
    display: none; 
    background-color: white; 
} 

.visibleDiv { 
    display: none; 
} 

.hiddenStyle { 
    cursor: wait; 
    z-index: 99999; 
    position: absolute; 
    top: 0; 
    left: 0; 
    height: 100%; 
    width: 100%; 
    background-color: white; 
    filter: alpha(opacity=70); 
} 

.busyStyle { 
     position: absolute; 
     top: 300px; 
     left: 550px; 
     text-align: center; 
     vertical-align: middle; 
     font-family: arial, helvetica, verdana, sans - serif; 
     color: red; 
     font-size: 16px; 
     font-weight: bold; 
     text-decoration: underline; 
} 

在JS在JSP

function showBusy() { 
    document.getElementById('mask').className = 'hiddenStyle'; 
    return false; 
    } 

<div id="mask" class="hiddenDiv"> 
     <div class="busyStyle"> 
      <img src="<%=request.getContextPath()%>/images/progress.gif" /> 
      <br/>loading 
     </div> 
</div>