damiancds Posted March 24, 2010 Share Posted March 24, 2010 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, Link to comment Share on other sites More sharing options...
ShadowMage Posted March 24, 2010 Share Posted March 24, 2010 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 containerThat'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. Link to comment Share on other sites More sharing options...
damiancds Posted March 24, 2010 Author Share Posted March 24, 2010 Great,that worked perfectly, the display: inline.thanks, Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.