How to hide a div inside iframe?

Member

by daisha , in category: HTML & CSS , 2 months ago

How to hide a div inside iframe?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by wilmer.lemke , 2 months ago

@daisha 

You can hide a div inside an iframe by targeting the div with CSS and setting its display property to none. Here's how you can do it:

  1. First, make sure that the div you want to hide has a unique ID or class name that you can target with CSS. For example, let's say the div has an ID of "myDiv".
  2. In the CSS section of your HTML document, add the following code to hide the div:
1
2
3
#iframeID #myDiv {
  display: none;
}


Replace "iframeID" with the actual ID of your iframe.

  1. Make sure the iframe has the same ID as you specified in the CSS. For example:
1
<iframe id="iframeID" src="example.html"></iframe>


  1. Save your changes and the div inside the iframe should now be hidden.