Iframe background image or color
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2015 08:56 AM
I would like to either have a background image that displays in an Iframe or change the background color of an iframe from white to some other color
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2015 09:07 AM
Hi John,
To accomplish this, you will want to change the background of page being embedded in the iFrame. This may not be as simple as changing the page's html tag's background as any tags nested inside of the html tag could have a non-transparent background which would be displayed over top. If you need more assistance, can you please provide some info about what you are embedding within the iFrame, possibly including some html?
Kind regards,
Travis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2015 10:08 AM
Hi Travis
I am really new to ServiceNow and still learning. I did try changing the back ground color but I had the problem you said. So I thoughyt I would try and add something to the CSS but that did not work either. This is what I said in the css
iframe#jamarsc_iframe2 {
background-color; "#acacac"
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2015 10:27 AM
Hi John,
Two things, 1 your syntax for declaring a style is incorrect and 2 I dont think you can target an iframes background from the parent window. Try the code below and if it doesnt work, let me know are you using a ui macro, ui page, dynamic block... etc.
iframe#jamarsc_iframe2 {
background-color: #acacac !important;
}
** Note, you technically should never have to use the !important declaration. What it does is says "what ever the background-color style is on this element, ignore it and use the one with !important" typically you want to address this at its source
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2015 10:39 AM
You would not try to access the iframe through the parent document as Alexander indicated. At this point I will assume you are putting an iFame in the CMS. Please provide more information if this is not the case. ServiceNow drops your CSS styles into the iFrame content. So you would treat your CSS selector as though it was already in the iFrame's document. So if you put the declaration on html instead of iframe#jamarsc_iframe, this would impact both the parent documents html tag and the iFrame document's html tag. This means you need to find a way to distinguish the documents. If you could provide some specific implementation details regarding the html you are embedding in the iFrame I could assist further.