Jump to content

[Solved] Inner div width problem


damiancds
 Share

Recommended Posts

okay,working with the tutorial on the image gallery here, I've hit a snagit's really nothing major, but...I've added a title that goes above the image and I want it to have a border that wraps to the texti've tried setting the width of the div to auto, but that made it as long as the outer container, even leaving the width complete out, but it still stretches to the outer containerCode:

div.gallery_lg{  margin: 2px;  padding: 1px;  height: auto;  width: 750;  text-align: center;    border: 2px solid #666666;  background-color: #DDF6DA;}div.gallery_lg_title{  margin: 2px;  line-height: 1.5em;  text-align: center;  border: 1px solid black;  background-color: white;}

where, div.gallery_lg is the outer container holding the title (div.gallery_lg_title)I only want the border to go a couple pixels to the outside of the text (manipulated by either the padding or margin property)if anybody can understand what I'm asking, and can give a hint, I'd really appreciate it.thanks,

Edited by damiancds
Link to comment
Share on other sites

i've tried setting the width of the div to auto, but that made it as long as the outer container, even leaving the width complete out, but it still stretches to the outer container
That's what div's are supposed to do... :)Try setting display: inline on the div or use a span instead of a div. Div's have display set to block by default, and block elements fill up all available width unless their width is specified. Specifying a width for your div is another option, but if the text is really short the div won't shrink to fit tight around the text, which is why I suggested changing the display. Edited by jkloth
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...