wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes CSS Selector for Embeded DIV Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "CSS Selector for Embeded DIV" Watch "CSS Selector for Embeded DIV" New topic
Author

CSS Selector for Embeded DIV

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1436
What syntax would I use to select the msgDisp div tag?

I have tried:

.msgDisp
.logonheaderdiv .msgDisp
.header1.loginheaderdiv .msgDisp
.logonheaderdiv>.msgDisp

I want to set the background-color to red but have it use the other attributes set by the .header1.loginheaderdiv div selector.


Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61084
    
  66

Steve Dyke wrote:What syntax would I use to select the msgDisp div tag?

I have tried:

.msgDisp

That will work just fine to select the element.

I want to set the background-color to red but have it use the other attributes set by the .header1.loginheaderdiv div selector.

How you select has nothing to do with what will be applied. Inheritable attributes will be passed down to descendants regardless of how you write the selector.

And what do you have against real words like message-display?

And what is this about:

onclick="javascript:showabout();return false;"

The javascript: pseudo-protocol is superfluous and, well, just flat out wrong. Remove it.

(I'd also argue that you should not be embedding behavior in the markup -- see Unobtrusive JavaScript -- but that's another show.)



[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1436
Bear Bibeault wrote:

(I'd also argue that you should not be embedding behavior in the markup -- see Unobtrusive JavaScript -- but that's another show.)




How would I use this stategy in this case?

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61084
    
  66

I don't know what you mean by "this strategy".
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: CSS Selector for Embeded DIV