Solved

css

Posted on 2011-09-08
3
179 Views
Last Modified: 2012-05-12
H ii have a problem i make a div with property
width:50%
float:left;

so it make 2 box in the screen and take 50%

The problem is when i try to make padding-left:20px; in the boxes it increase size of the total div and it make it more then 50% so it go to the second line. How i can limit so it subtract from 50% - 20px left and save size of box perfect 50%.
0
Comment
Question by:umaxim
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
ID: 36503880
Precisely the reason why it is not always a good idea to give width/height/left/top in percentages.

However, if you want to give in percentage, then also give padding in percentage

width:45%
float:left;
padding-left:5%;
0
 
LVL 1

Author Comment

by:umaxim
ID: 36503916
is not way to make it as specific box or something so it will not allow to change width
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 36503976
But if you add 20px to 100%, then it will be overflow only.
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question