user2559519
user2559519

Reputation:

CSS Overflow: hidden works at first and then doesn't?

For some reason the code below works once, but if I change the height values for .Image, it stops working. The test image overflows instead of being hidden. Then the containing div won't resize no matter how often I try to change height.

    .Image{
        background-color:red;
        height:400px; 
        overflow:hidden;    
    }

 </style>

</head>
<body>
<div class="main">
    <div class="Image">
        <img "src="images/test.jpg" alt="test">
         </div> 
</div>
</body>
</html>

Upvotes: 1

Views: 144

Answers (1)

kanthonye
kanthonye

Reputation: 159

the reason why is doesn't work is because you have an error in your code at img

<img "src="images/test.jpg" alt="test">

your error is ->

<img "src="...">

it should be ->

<img src="...">

with out the extra quote

so your code should look like this

   .Image{
        background-color:red;
        height:400px; 
        overflow:hidden;    
    }

 </style>

</head>
<body>
    <div class="main">
    <div class="Image">
        <img src="images/test.jpg" alt="test">
    </div> 
    </div>
</body>
</html>

Upvotes: 1

Related Questions