Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 76
  • Last Modified:

100% width of parent

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
tonelm54
Asked:
tonelm54
  • 2
1 Solution
 
Tom BeckCommented:
You have 5px of padding so it sticks out 10px. Try padding:5px 0.
0
 
Tom BeckCommented:
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
 
Mikkel SandbergFront End DeveloperCommented:
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now