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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:56:50+00:00 2026-06-04T03:56:50+00:00

My code: $css=.class1{ padding:1330px 2220px 0 auto; padding:10px auto 0 20px; padding:101px auto 0

  • 0

My code:

$css=".class1{
    padding:1330px 2220px 0 auto;
    padding:10px auto 0 20px;
    padding:101px auto 0 200px;
}";

$search=self::extract_unit($css,"padding:",";"); 

extract_unit: this function extracts content between [padding:] and [;]

will return 1330px auto 0 2220px

$replace=self::resort_padding_margin($search);

resort_padding_margin: this function resorts the content

will return 1330px 2220px 0 auto

$css = str_replace($search, $replace, $css);
echo $css;

when i apply this code the result will show like this :

.class1{
    padding:1330px auto 0 2220px;
    padding:10px auto 0 20px;
    padding:101px auto 0 200px;
}

So how can i use this method to apply all padding to be show like this

.class1{
    padding:1330px auto 0 2220px;
    padding:10px 20px 0 auto;
    padding:101px 200px 0 auto;
}
  • 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-04T03:56:51+00:00Added an answer on June 4, 2026 at 3:56 am

    For this to work, your self::extract_unit method has to return an array, one item per occurrence of padding.

    Then your self::resort_padding_margin should accept the search array and return another array with the modifications. Alternatively, write a loop in your main code and store the results of each call to this method inside an array.

    When done, you can pass both arrays to str_replace.

    Btw, a CSS should only have one padding definition. You have three, which is a bit strange 🙂

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

Sidebar

Related Questions

My CSS CODE : body { padding:0; margin:10px auto; width:800px; } .wrapper { width:800px;
this is the CSS code... .breadcrumb { font-size: 10px; background-color: #006600; padding: 0px 2px
this is my code : <style type=text/css> #draggable { width: 100px; height: 100px; padding:
CSS code body { background-attachment: scroll; background-clip: border-box; background-color: #ececec; background-image: none; background-origin: padding-box;
in some CSS code I found out this type of selector div#someid Is this
Is there a CSS code that changes this text This is it to this
i have this CSS code: h1 { font-size:22px; color:#341C12; font-weight:normal; font-style:italic; } .h1color h1{
Here is my code for css div based layout. I want a search box
Is there any way I can rename this CSS code to only affect a
I am writing some css code for a school website that looks like this

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.