---
title: "How can I hide a div using visible property even it has a background"  
description: "How can I hide a div using visible property even it has a background"  
author: "Pravesh Singh"  
published: 2014-08-23  
updated: 2014-08-23  
canonical: https://www.mindstick.com/forum/2107/how-can-i-hide-a-div-using-visible-property-even-it-has-a-background  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 1 minute  

---

# How can I hide a div using visible property even it has a background

I have the following div:

<div visible="false"

[style](https://www.mindstick.com/articles/126300/apa-citation-style-get-to-know-about-it-for-your-next-assignment)="[background](https://www.mindstick.com/articles/65/how-to-change-background-color-of-tab-control-in-c-sharp)-[image](https://www.mindstick.com/articles/23551/an-investigate-distinctive-seafood-restaurant-for-your-image-stamp-character):[url](https://www.mindstick.com/forum/436/url-redirection)('../Contents/[Images](https://www.mindstick.com/interview/1067/what-is-the-php-predefined-variable-that-tells-the-what-type-of-images-that-php-support)/[item](https://www.mindstick.com/forum/156564/remove-item-in-an-array-in-javascript)-background-selected.png'); width:113px; height:58px; background-[repeat](https://www.mindstick.com/forum/156775/give-an-example-of-the-linq-repeat-method): no-repeat; position: [absolute](https://www.mindstick.com/interview/1159/what-is-absolute-and-sliding-expiration-in-dot-net);" />

<div>

It's still visible in spite of the visible [property](https://www.mindstick.com/blog/205/property-notification-in-c-sharp) is set to false. but when I [remove](https://yourviews.mindstick.com/story/4554/8-harmful-weeds-to-remove-from-garden) the background-image from the style it's hidden.

How can I hide it with keeping its background?

Thanks in advance.

## Replies

### Reply by Sumit Kesarwani

Hi Pravesh, \
try this:

```
visible="false"is a server control property, unless the div has runat="server"set, it will be ignored, since the browser/client does not know how to handle that.try CSS instead:.myDivClass {  display:none; /** or: visibility:hidden;  which is slightly different **/  background-image:url('../Contents/Images/item-background-selected.png');  width:113px;  height:58px;  background-repeat:  no-repeat;  position: absolute}
```


---

Original Source: https://www.mindstick.com/forum/2107/how-can-i-hide-a-div-using-visible-property-even-it-has-a-background

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
