Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CSS Selector for Embeded DIV

 
Steve Dyke
Ranch Hand
Posts: 1619
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64688
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.)


 
Steve Dyke
Ranch Hand
Posts: 1619
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64688
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what you mean by "this strategy".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic