Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8078259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:44:09+00:00 2026-06-05T15:44:09+00:00

i want to decrease the font-size and maybe even the colour (with a loop?).

  • 0

i want to decrease the font-size and maybe even the colour (with a loop?). is it possible in LESSCSS? I tried the following and it works but it only decrease the font size by 1 each time – for obvious reasons. is there another way of doing this?

at the moment this:

 @iterations: 6;
  h(@index) when (@index > 0) {
    (~"h@{index}") {
        font-size: 21px - @index;
    }
    h(@index - 1);
  }
  h(0) {}
  h(@iterations);

is giving me this:

 h6 { font-size:15px; }
 h5 { font-size:16px; }
 h4 { font-size:17px; }
 h3 { font-size:18px; }
 h2 { font-size:19px; }
 h1 { font-size:20px; } 

but it’s not quite what i’m after. i want the “h” to decrease by one – which it currently does – and the font-size to decrease by – lets say – 5px for every loop.

any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:44:11+00:00Added an answer on June 5, 2026 at 3:44 pm

    You already have the hard part. You can multiply in LESS with * So it’s pretty easy to adapt your loop however you want. As an example:

    @iterations: 6;
    h(@index) when (@index > 0) {
        (~"h@{index}") {
            font-size: 40px - @index*5;
        }
        h(@index - 1);
    }
    h(0) {}
    h(@iterations);
    

    Compiles down to:

    h6 { font-size:10px; }
    h5 { font-size:15px; }
    h4 { font-size:20px; }
    h3 { font-size:25px; }
    h2 { font-size:30px; }
    h1 { font-size:35px; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code, but i want in second loop a decrease of $p
I want this highchart - http://jsfiddle.net/zPDca/ inside a popup. But if i decrease its
I want to decrease the size of .obj files in a large project I'm
I want to increase or decrease or even mute the volume of movie player
I want to set the font size of button on componentResized event. I get
I want to increase/decrease the font of and element, then the next element of
For a JavaScript project we want to introduce object inheritance to decrease code duplication.
Want the function to sort the table by HP but if duplicate HPs then
I have written this code where I want to increase / decrease number of
I have a HTML page where I want one button to increase the font

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.