Solved

css

Posted on 2011-09-08
3
177 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What kind of framework must i use to do that ? 2 48
CSS in HTML 5 68
Search Box CSS Question 16 50
Make Float not to Wrap 15 67
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.
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

752 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