Solved

100% width of parent

Posted on 2015-01-13
3
55 Views
Last Modified: 2015-01-19
Quite a silly question, but I'm trying to fit a div element into the parent by setting width:100%; however its overflowing the parent, see my example in jsfiddle

As you can (hopefully) see:-
overflow
Any ideas whats going wrong? Setting the width 100%
0
Comment
Question by:tonelm54
  • 2
3 Comments
 
LVL 38

Expert Comment

by:Tom Beck
ID: 40547684
You have 5px of padding so it sticks out 10px. Try padding:5px 0.
0
 
LVL 38

Accepted Solution

by:
Tom Beck earned 500 total points
ID: 40547713
To pad the text without affecting the width of the parent div you could put the text in a span tag and pad that.

http://jsfiddle.net/dL624hxk/1/
0
 
LVL 6

Expert Comment

by:Mikkel Sandberg
ID: 40547942
There also appears to be something funky with your jQuery. When you click on a title that is already selected, the .divBody for the title collapses and then expands again. I'm not sure if this is the desired effect, but it just behaves different than I was expecting.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
css question 1 45
Urgent need help ASAP With CSS 5 37
jQuery scrollTop 2 40
Centering a nested div 16 55
Creating a CSS block that only applies to printing By default, all of your CSS applies to every possible view of your page - whether on screen, printed, landscape, touch-screen, or whatever.  You can, however, add CSS that only applies under certai…
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 tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
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…

948 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now