Solved

100% width of parent

Posted on 2015-01-13
3
53 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

708 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

15 Experts available now in Live!

Get 1:1 Help Now