title: How To Make Part of Web View Slightly Translucent?
body: <p>In <code>Objective-C</code> with <code>Mac OSX</code> <code>Cocoa</code>, is there any way to make a <code>DIV</code> on a <code>WebView</code> slightly translucent so that the desktop applications behind the window bleed through slightly, but only on that <code>DIV</code> and not the rest of the <code>WebView</code>?</p>
  
  <p>Or perhaps I can make the whole WebView translucent, but turn it off for all <code>DIV</code>s except one <code>DIV</code>?</p>
  
  <p>I have a <code>WebView</code> loading a web page. In the web page, I have a sidebar on the left, and then an <code>IFRAME</code> on the right. I click items on the sidebar and they change the <code>IFRAME</code> pages on the right. It's this sidebar that I want to make slightly translucent.</p>
  
  <p>In my <code>AppDelegate.m</code>, I have this so far, and my <code>HTML</code> and <code>BODY</code> tags are set to <code>background:none</code>, and my sidebar is set to <code>background:rgba(0,0,0,0.5)</code>, but all I end up seeing is a grey sidebar background. It's like the webview itself wants to ensure that it's background is set to a color other than clear.</p>
  
  <pre><code>- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
  {
    // note that _window and _wv are outlet properties to my window and webview widgets
    [_window setBackgroundColor:[NSColor clearColor]];
    [_window setOpaque:NO];
  
    [_wv.layer setBackgroundColor:[NSColor clearColor].CGColor];
    [_wv.layer setOpaque:NO];
  }
  </code></pre>