edit css style of an element with a space in its class name

后端 未结 3 983
广开言路
广开言路 2021-02-07 17:19

I\'m creating a tumblr them and I have to write an external CSS file but I am having trouble editing the css style of the post elements.

This its structure:

<         


        
3条回答
  •  感情败类
    2021-02-07 17:42

    This element actually has two classes - it is marked with both the post class and the quote class. So, you can use the following selectors to access it:

    // css
    .post { ... }   // elements with the post class
    .quote { ... }  // elements with the quote class
    
    // jQuery
    var postLis = $('.post');
    var quoteLis = $('.quote');
    

    You can also stack selectors to return all elements which meet all conditions in the selector, by including the different selectors together:

    // css
    .post.quote { ... }  // elements with both the post and quote classes
    
    // jQuery
    var postAndQuoteLis = $('.post.quote');
    

提交回复
热议问题