user3727055 user3727055 - 2 months ago 6
HTML Question

How to hide a div on certain pages using CSS

I have just finished creating my new template layout for my website. I want to use the same layout on my login page, but there are two divs that use use the URL CSS coding for images, but I dont want them to be shown on the login page.
How can I hide these divs using CSS without using a

style
tag in the login page to over ride the CSS file?

Here is an example of the basic layout:

example css{
background-image: url("paper.gif");
}

<div class="example div">


Now all I want is that example
div
to not show in login.php.
Please note that I'm using PHP include to grab my template files for my website.
Another idea, could I do something like this?

If(index.php){
div example{
display:none;
}
}

Answer

you can use style as a property of a div

<div class="example div" style="visibility:hidden;">

this will require to create a new layout .

or you can just use this js code in the login page

document.getElementById('hdiv').style.visibility="hidden";

and just add an id for the div. or you might use getElementsByClassName.

Comments