css selector problem - Forum

Forum Navigation
You need to log in to create posts and topics.

css selector problem

Hi luishp,

I use the below css selector, it works good but whenever I run in the browsers it disappear.

div[class="test"]{
   background-color:red;
}

 

@asmat where are you typing that code?
The problem is probably due to VisualNEO trying to get the text within the brackets "[" and "]" from a variable.
Have you added the CSS to Project > Properties > Styles?

@luishp

Yes, I have added the CSS to Project > Properties > Styles.

Please @asmat share a sample app so I can take a look. Thanks!

@luishp,

Please take a look to attached file.

 

Uploaded files:
  • You need to login to have access to uploads.

asmat

Try this in Project >>> Properties >>> Styles ...

.test {
background-color:red;
}

.box-error {
background-color:blue;
}

.box-warning {
background-color:blue;
}

 

Since you have specified classes for your boxes as test, box-error and box-warning, you associate properties for these classes by specifying a dot before the same name.

If you wanted these properties to only apply to html elements of the type div with a class of test, you would specify div.test instead of .test

If you wanted these properties to only apply to elements with an id of (say) Container1, you would specify #Container1

For a more detailed understanding of css selectors, visit https://www.w3schools.com/css/css_selectors.asp

 

 

@asmat, if I just delete those selectors the Containers keep the same aspect so they don't do anything at all.

asmat has reacted to this post.
asmat

Thanks from both of you @Gave and @luishp.