leykan
leykan

Reputation: 389

Blocking scroll in CSS doesn't work

I want to block scroll in my pages this is the html pages :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">                                                                        
<html xmlns="http://www.w3.org/1999/xhtml">                                                                                                                                          
<head>                                                                                                                                                                               
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />                                                                                                                
<title>Techniques AJAX - XMLHttpRequest</title>                                                                                                                                      
<script src="frise.js"></script>                                                                                                                                                     
<link rel="STYLESHEET" type="text/css" href="style.css">                                                                                                                             
<script>                                                                                                                                                                             
    var a;                                                                                                                                                                       

    function start()                                                                                                                                                             
    {                                                                                                                                                                            
             a = new frise("frisekk", 'Mon Nov 15 2014 19:25:00', 'lab', 600);                                                                                                   
    }                                                                                                                                                                            
</script>                                                                                                                                                                            
</head>                                                                                                                                                                              

<body onload="start();">
<div id="blocantiscroll">                                                                                                                                                              
    <div id="frisekk"> <br/> </div>                                                                                                                                              
</div>                                                                                                                                                                                                                                                                                                                                             
</body>                                                                                                                                                                           
</html>

So I call my CSS in <div id="blocantiscroll">

but nothing happen, I have look on the web and this should work but it doesn't, the sroll is always active. Is there a problem in my html page or in my CSS ?

my CSS :

blocantiscroll {
height: 100%;
overflow: hidden;

}

Upvotes: 0

Views: 60

Answers (3)

Turnip
Turnip

Reputation: 36712

blocantiscroll is an ID so you need to use # in your selector:

#blocantiscroll {
    height: 100%;
    overflow: hidden;
}

Your current selector is looking for an element of type blocantiscroll which doesn't exist.

Further reading

Also, if you want #blocantiscroll to be 100% height of the window, you will need to set the below:

html, body {
    height: 100%;
}

Upvotes: 1

annam priyatam
annam priyatam

Reputation: 101

blocantiscroll is an ID.. so you need to specify # before "blocantiscroll" give it as:

#blocantiscroll

Upvotes: 1

Gezzasa
Gezzasa

Reputation: 1453

Add this to your css

body {overflow: hidden;}

Upvotes: 0

Related Questions