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

  • Home
  • SEARCH
  • 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 8004479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:55:53+00:00 2026-06-04T16:55:53+00:00

As you can see in the image attached, I have a wrapper div inside

  • 0

enter image description here

As you can see in the image attached, I have a wrapper div inside which I have section.
Now, I want that all content inside section should have space on all sides (i.e. I want padding on all content inside section. I cannot do,

section {
  padding:20px;
}

because it will increase the width of section to 1020 + 20 (left padding) + 20 (right padding) = 1060px.

Since, direct children inside section are not always div (there are aside and p too), I cant do

section div{
 margin:20px;
}

Currently, I am doing

section > *{
    margin:20px;
}

So that every element takes a 20px margin from section. This works for me but I’ve heard that we should not use universal selector (*), its a performance bottleneck. Also, is this even cross browser ?

I’ve also thought to create a wrapper div inside all sections which will take all all elements inside it, so that I can do

section > div{
  margin:20px;
}

But, is this worth changing markup . Will it be so slow with universal selector ?

  • 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-04T16:55:55+00:00Added an answer on June 4, 2026 at 4:55 pm

    You can use comma separated selectors, like this

    section > div, section > aside, section > p {
        margin:20px;
    }
    

    Or, of course, give all the things that need margins a class, and use that class for a selector. As long as you don’t use “hasmargins” for a class name…

    But I’m not sure why you think that by giving the sections inside the wrapper div a padding, you’ll increase the total width of the wrapper div. Am I missing something?

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

Sidebar

Related Questions

I have a div that contains 3 fields You can see the image here
Please see attached image alt text http://img248.imageshack.us/img248/7743/datefrom.png I have a table which have FromDate
As you can see from the attached image, I've got a couple of workers
I have a Dell Inspiron E1505 and as you can see in this image
I have an iPhone screen (see attached image) where the UITextView fills almost the
On this page: http://www.colorz.fr/#!/work/ You can see the image scrolls into/out of the direction
As you can see on http://jsbin.com/erivi/ I'm using Jquery to change some image (and
I'm plotting on top of an image in Matlab. Sometimes, I can't see what's
Basically just looking to see if you can capture an image from the webcam
In my app, users can tap on image thumbnails to see a full size

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.