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 3937202
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:02:30+00:00 2026-05-20T00:02:30+00:00

Lets say I wrote a simple CSS rule like this: .star_10 { background: url(stars.png)

  • 0

Lets say I wrote a simple CSS rule like this:

.star_10 {
  background: url(stars.png) no-repeat 0 0;
}

And I need 10, so I copied it 9 times.

.star_10 {
  background: url(stars.png) no-repeat 0 0;
}
.star_10 {
  background: url(stars.png) no-repeat 0 0;
}
.star_10 {
  background: url(stars.png) no-repeat 0 0;
}
.star_10 {
  background: url(stars.png) no-repeat 0 0;
}
.star_10 {
  background: url(stars.png) no-repeat 0 0;
}

etc.

Now I want to change the star_10 and 0 0 with incremented values so it looks like this:

.star_10 {
  background: url(stars.png) no-repeat 0 0;
}
.star_9 {
  background: url(stars.png) no-repeat 0 -18px;
}
.star_8 {
  background: url(stars.png) no-repeat 0 -36px;
}
.star_7 {
  background: url(stars.png) no-repeat 0 -54px;
}

and so on…

So how can I search/replace every instance, do a calculation and write it?

  • 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-05-20T00:02:30+00:00Added an answer on May 20, 2026 at 12:02 am

    You can do it easily with a macro. Lets say you have only this:

    .star_10 {
      background: url(stars.png) no-repeat 0 0;
    }
    

    Place your cursor over the first dot (in .star10) and type the following in normal mode:

    qa3yy3jp^Xjt;18^Xk0q
    

    Explaining:

    1. qa will start a macro recording in register “a”.
    2. 3yy will yank (copy) the following 3 lines.
    3. 3j will place the cursor 3 lines down.
    4. p will paste the past yanked text.
    5. ^X (ctrl+x) will decrement the star class number.
    6. j will place your cursor one line down.
    7. t; will place your cursor before the next ; in the current line.
    8. 18^X will decrement the y coordinate of backround by 18;
    9. k will put the cursor one line up,
    10. 0 will put the cursor at the beggining of the line.
    11. q will finish the macro recording.

    After that, you may have something like this.

    .star_10 {
      background: url(stars.png) no-repeat 0 0;
    }
    
    .star_9 {
      background: url(stars.png) no-repeat 0 -18;
    }
    

    That’s it. Just place your cursor at the dot on .star_9 and press 8@a to execute the macro recorded in register a eight more times.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I wrote a pretty simple class called ValueFinder that looks like this:
I've simple example to describe my problem. Lets say I've table structured like this
Lets say i wrote helper for TStringList TslHelper = class helper for TStringList function
Let's say I accidentally wrote this: do { } while (true); ...and then ran
Let's say I have an array like this: $array = array ('1','2','3','4'); And I
im new in PHP and im trying to write simple online shop. Lets say
Lets say I want to write an AJAX chat box, just something simple, I
I want to write a simple applet to put in a tray. Let's say
Let's say I wrote a program containing an algorithm that had an exponential runtime
Lets say that I am writing a program that supports plugins and I write

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.