PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, July 18, 2022

[FIXED] How to set style with LESS according to body id

 July 18, 2022     css, document-body, Less     No comments   

Issue

Is there any option to set style for some element according to body id with LESS?

I need to do something like this:

@body_about = #about_page;

img when (isclass(@body_about)){
   // some style
}

this img defintion is deeply buried and I do not want to draw it to the top of... Is there any option to do this? Thx for help.


Solution

This is a conjecture of what you need based off your comment about the "definition is deeply buried" and your first comment to MarmiK's answer. If I am way off what you need here, let me know and I'll remove my answer.

LESS

.someClass1 {
  .someClass2 {
    .someClass3 {
      img {
        /* normal code */
        #about_page & {
          /* about page code */
        }  
      }     
    }
  }
}

CSS Output

.someClass1 .someClass2 .someClass3 img {
  /* normal code */

}
#about_page .someClass1 .someClass2 .someClass3 img {
  /* about page code */

}


Answered By - ScottS
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing