File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Style issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Style issue" Watch "Style issue" New topic
Author

Style issue

nirjari patel
Ranch Hand

Joined: Apr 23, 2009
Posts: 357
I have a style applied in JSP as below


when it say .bb_hpList .promotionsTV , it means two classes bb_hpList and promotionsTV are applied to this element. what does the syntax ".bb_hpList .promotionsTV[class]" mean ?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

nirjari patel wrote:when it say .bb_hpList .promotionsTV , it means two classes bb_hpList and promotionsTV are applied to this element.

No, it doesn't. It means an element with class promotionsTV with an ancestor element with class bb_hpList. (Geez, could the names be any less readable?)

what does the syntax ".bb_hpList .promotionsTV[class]" mean ?

Doesn't make much sense. It means that the element with the promotionsTV element must have a class attribute. Which, of course, it must already have in order to possess promotionsTV in the first place.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
nirjari patel
Ranch Hand

Joined: Apr 23, 2009
Posts: 357
1)
It means that the element with the promotionsTV element must have a class attribute

What is meant by this statement ? I dont understand what is meant by "class attribute" ? We have diffrenet parameters used as attributes in style like color, height, width etc. But I have never seen class as an attribute. Can you please explain this in more details ? If I want to make height attribute a must for the promotionsTV, can I specify it as .promotionsTV[height] ?

2) when it say bb_hpList promotionsTV , it means two classes bb_hpList and promotionsTV are applied to this element ?

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

nirjari patel wrote:But I have never seen class as an attribute.

How do you think a class like promotionsTV gets applied to an element?


can I specify it as .promotionsTV[height] ?

No. Height is not an attribute, it's a style property.

2) when it say bb_hpList promotionsTV , it means two classes bb_hpList and promotionsTV are applied to this element ?

No. See my first reply. And without the dots, it's just invalid.
nirjari patel
Ranch Hand

Joined: Apr 23, 2009
Posts: 357
Thanks for taking pains in answering

Following syntax confuse me.

1)

In this there are two classes "bb_oneList" and "promotionsTV" , does it mean that both classes are applied to this element ? I understand that when these class names are preceded by the "." , then it follows parent-child relationship in selecting the elemnt where to apply this style.

2) In "promotionsTV[class]" , what can be the appropriate value in place of class ? when shall we use such a syntax ?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

nirjari patel wrote:Following syntax confuse me.
1)In this there are two classes "bb_oneList" and "promotionsTV" , does it mean that both classes are applied to this element ?

Yes.

I understand that when these class names are preceded by the "." , then it follows parent-child relationship in selecting the elemnt where to apply this style.

No. The dot merely signifies a class name in the selector, differentiating it from ids (designated with #), and element names (which have no prefix).

An ancestry relationship is specified with a space in the selector.

.aaa .bbb signifies an element with class bbb with an ancestor element with class aaa.
.aaa.bbb (no space) signifies an element possessing both classes aaa and bbb.

2) In "promotionsTV[class]" , what can be the appropriate value in place of class ? when shall we use such a syntax ?

You'd use the [] syntax to identify elements with the specified attributes. For example: identifies all image elements with the alt attribute, but not those that lack it.
nirjari patel
Ranch Hand

Joined: Apr 23, 2009
Posts: 357
I am still not understanding the use of [class]

.bb_oneList and [class].bb_oneList , are these two different classes ?
I understand that class is used as attribute in <Li class="bb_onleList promotionsTV" />, but what has that to do with [class] as prefix or suffix in a class definition ? [class].bb_oneList or .bb_oneList[class] ?

In some cases , .bb_default is applied, but it does not show up in the class names when I check that element
<Li class="bb_hpList promotionsTV" />When I check the style in developer tool bar, I see

So why is class bb-default not appearing in the list of classes applied to <Li> , shall it not be <Li class="bb_hpList promotionsTV bb_default"> ?

In some cases , when I check style in developer tool bar, I see

where does the style come from ? From the parent tag ? But, does not every element have their own style ?

thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

nirjari patel wrote:I am still not understanding the use of [class]

That's because, as I said early on, it makes no sense.

I can't make out what you are asking in the rest of your question, except to day that: no, classes aren't inherited from parents, but yes, the applied styles can be.

It sounds like you really need to get yourself a good CSS reference. Forum question can cover only so much.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Style issue
 
Similar Threads
table heading moves
Attribute selector is not working
Creating jsp file without .jsp extension
How to hide a cell w/ background image until a function call
changing height of the text box in html?