CSS - Making <td> Tag Not Stretch?
Hi,
I am editing a dynamically driven site and I don't have access to edit the HTML code, just the CSS. I have a <div> with content in it within a <td> tag. When the div stretches past the width of the <td> tag it makes the table cell wider. Is there any way in CSS to have it not stretch the width of the cell? The <div> has an id="mylinks" on it, however the <td> or the <table> doesn't have any id or class on them. I'm pully my hair out trying to figure out a fix, any help would be greatly appreciated, Thanks in advance Similar TutorialsHey I am developing a site for our band, and I'm having trouble getting the nav bar to look right. The page is http://www.mattbray.curvedspaces.co..._beta/index.php and I don't want the left hand section to stop halfway down the page. The stylesheet is called style.css in the same directory. Code: /* page defaults */ body { margin: 0px; padding: 0px; text-align:center; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #EAEAEA; } /* Layout divs */ #container { font-family: Verdana, Arial, Helvetica, sans-serif; color: #666666; position: static; left: 40px; top: 12px; padding: 0px; width: 800px; border-right: #003366 1px solid; border-left: #003366 1px solid; margin-right: auto; margin-left: auto; height: auto; text-align:left; background-color: #FFFFFF; } #title { background-image: url(images/saved_title.gif); margin-top: 10px; background-repeat: no-repeat; height: 150px; border-top-color: #000000; border-top-style: solid; border-top-width: 1px; border-bottom-color: #000000; border-bottom-style: solid; border-bottom-width: 1px; border-color: #000000; } #navbar { background-image: url(images/navbar.gif); background-repeat: no-repeat; border-bottom-color: #000000; border-bottom-style: solid; border-bottom-width: 1px; padding: 5px; height: 20px; font-family: Verdana, Arial, Helvetica, sans-serif; } #navwin { font-family: Verdana, Arial, Helvetica, sans-serif; border-right: 1px solid black; padding: 5px; background-color: #CCCFFF; width: 230px; height: 100%; margin: 0; float: left; font-size: medium; } #content { float: left; font-family: Verdana, Arial, Helvetica, sans-serif; padding: 10px; padding-top: 40px; background-image: url(images/content.gif); background-repeat: no-repeat; background-position: -239px 0px; background-color: #FFFFFF; height: auto; width: 539px; } #footer { font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #CCCCCC; margin-bottom: 10px; padding: 10px; border-top: solid 1px black; border-bottom: solid 1px black; width: 780px; height: 25px; text-align: center; } /* Links */ a:link { color: #006699; } a:visited { color: #006699; } a:hover { color: #006699; text-decoration: none; } a:active { color: #006699; } /* elements */ #navwin h2 { font-size: large; display: block; } #navwin ul {} thanks Matt Is there any way to make divs stretch to fit the content of the div? I don't want to hear about how to make them stretch to the size of the page. How do you get them to streth to fit what is in them? I feel so STUPID. I have DIV[a] inside DIV[a] is DIV[z] DIV[z] is 200px high. there is no height attribute et for DIV[a] shouldnt DIV[a] stretch atleast to fit in DIV[z] You can see here, in firefox, the dark background only comes down 200px. That is because its height is at 200px, i did that so you could see it. If I remove the height attribute, it dissapears completley. The menu and such on the left are within this div, so it should stretch correct? It works fine in IE. If I need to explain more let me know. Thanks I have been trying to work a lot with CSS3 to rotate, scale, etc. One effect I've been trying to figure out is how to stretch something. I could scale it along the y axis but that's not really stretching. A stretch would mean the top and bottom (or left and right) sides would curve inward. How can I distort an element in this fashion? right.... i have two fixed width columns and i want them to be the same height - the height of whichever has the most content. so i figured i do something like: +---------------------+ | +-----+ +----+ | | | | | | | | | | | b | | | | a | | | | | | | +----+ | | | | | | +-----+ | +---------------------+ (OK - problems with spaces and non breaking thingy.. do you get the idea though? ) the container div will stretch to fit the content, divs a and b will increase in height depending on content. so i was thinking if i set divs a and b to be 100% height it would work. however, this will do nothing if i haven't defined the height of the parent (container). so i think, ok, i'll set that to 100% as well. however this does not work. when i say "does not work" i mean the following: my container div fills the viewport. the column divs stretch from the bottom to the top of the page. -- all ok this far. when i add a load of content, i the div (a or b) will stretch beyond the viewport BUT the other one doesn't. now.. does anyone have any ideas of how i could do this? has anyone seen this anywhere? any help appreciated. d Hello... I'm having some trouble. I have a container div set to 100% width. I have 2 small fixed width divs floated right and left and then a div between them that needs to stretch to fufill the 100% width while showing the background image of the container div. Works in Firefox, IE7... not so much. Any help is appreciated in advance CSS #container { width: 100%; background: url('images/topM.gif') repeat; } #leftFloat { width: 30px; float: left; } #rightFloat { #width: 30px; float: right; } #middleStretch { height: 25px; } --------------------------- XHTML <div id="container"> <div id="leftFloat"/>image goes here</div> <div id="rightFloat">image goes here</div> <div id="middleStretch">this div should stretch to fill the space between the left & right floats showing while repeating container background image</div> <!--end #container--></div> Can someone please tell me what the font-stretch property within CSS does? I have been playing around with the following online example, but the way the text is rendered never changes. [access the world wide web]w3schools.com/js/tryit.asp?filename=try_dom_style_fontstretch Could someone please tell me how to use the font-stretch property? I am just trying to see what it does. Thank you! The font-stretch property, for example:
css Code: Original - css Code font-stretch: condensed; font-stretch: condensed; doesn't seem to be adequately supported by most browsers, even though it has been part of CSS 2 for quite a while. Most references I checked seemed to point to system font dependency, i.e., if your system does not have a condensed or expanded version of that particular font installed, no change in font width will appear. Why is this? Microsoft Word has an algorithm to stretch and condense all fonts, not just those with special versions. Why can't the css standard use a similar display algorithm to implement font-stretch? i put a div container around all my divs (so i could center them and put a bg and border) and put height at 100% but it only stretches from the top of the viewable page to the bottom. if a text content div stretches beond the page (and i have to scroll) the main content div cuts off. i set body height to 100% also. i cant figure out a way around this other than set the height in PX but since the content will be includes i have no way of know how much will be on each page. is there anyway around this, even if i have to use tables. I am working on this template: http://www.oswd.org/design/preview/id/2790 & I need both the white & green content boxes to stretch as I add content. I don't know if this is even possible but would like to know if there is an easier way than having to create another (more stretched) image. Also as the content will be changing frequently I don't want to have to change from one image to another if I can help it. Appreciate any help you can give. Hi, Just wondering if anyone can tell me how i would go about stretching a background image for my website so as it stretches with different page sizes and resolutions an all the rest http://www.ourdayton.com/index.html?do=regUser reffering to the dark blue box with the form contained in it: With the width set to default, or width:auto, it stretches to fit the parent. If I specify a width, the box will not stretch to hold the content within it. I've also played with min-width/max-width to no avail. I'm sure im just missing/forgetting a property. Here is the code for the box: Code: #generalBox{ width: auto; margin-left: auto; margin-right: auto; padding: 8px 8px 8px 8px; border: 1px solid #525c69; background-color: #212a34; text-align: center; } I can only get my page to display correctly in IE6. Not IE7 or Firefox. If anyone could help, it'd be much appreciated! Basically, the borders on the left/right don't stretch all the way down the page in IE7 and Firefox (like they do in IE6). Here is the website: http://www.stacyandmatt.com/ Here's the simple HTML: Code: <body> <div id="container"> <div id="maincontent"> <div id="header"> <p> </p> </div> <div id="navBar"> <p> </p> </div> <div id="mainRight"> <img src="images/mainPic.jpg" /> </div> <div class="spacer"> </div> </div> </div> </body> And here is the CSS: Code: html, body { background: #000; font-family: Arial, Helvetica, sans-serif; padding: 0; margin: 0; color: #F09; height: 100%; line-height: 1.5em; } #container { background: #000; height: 100%; width: 780px; margin:auto; padding: 0; text-align: justify; } #maincontent { background: #000 url(../images/borderTest.jpg) repeat-y top left; height: 100%; margin: 0px; padding: 0px; width: 100%; border-right: 6px solid #F09; overflow: visible; } #header { background: url(../images/header.gif) no-repeat top left; width: 100%; height: 141px; margin: 0px; padding: 0px; } #navBar { width: 155px; float: left; padding: 20px 0px 0px 40px; margin: 0px; color: #000000; } #mainRight { width: 555px; float: right; padding: 20px 5px 0px 5px; margin: 0px; } .spacer { clear: both; } Thanks! Hello, I have been playing with this for a few days now and I am completely frustrated. The left side bar and the right side bar I need to auto stretch. I veiwed everything in several different browsers and screen resolutions. I orginally hade a body background picture and it worked perfectly except on firefox at 800x600. It was left aligned instead of centered. So.. I made the backrounds and border colors instead. Now the problem is I cannot get them to auto strech - I am very frustrated. It seems to be all messed up in IE5.5 at 800x600. Can anyone take a look and help me? Thanks in advance! If you need the html - I would be glad to provide it. Here is the css file: body { margin: 0px; padding: 0px; background: #666666 url(images/back.png) repeat-y center top; text-align: justify; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; color: #333333; } h1, h2, h3, h4, h5, h6 { font-family: Georgia, "Times New Roman", Times, serif; color: #3399FF; } a { font-weight: bold; text-decoration: none; color: #33CCFF; } a:hover { text-decoration: underline; color: #33CCFF; } /************* HEADER STUFF ************/ #header { width: 995px; height: 200px; margin: 0px auto; padding: 0px 0px; background: yellow; } #header2 { width: 995px; height: 10px; margin: 0px auto; padding: 10px 0px; background: yellow url(images/header.jpg); } #header h1 { margin: 0px; padding: 0px 0px 0px 10px; text-align: left; color: #3399FF; font-size: 3em; text-transform: uppercase; } #header h2 { margin: 0px; padding: 0px 0px 0px 20px; text-align: left; font-size: 1.5em; text-transform: uppercase; } /************* MENU ************/ #menu { width: 995px; margin: 0px auto; padding: 5px 0px 5px 0px; background-color: #000000; height: 28px; } #menu ul { margin: 0px; padding: 0px; list-style: none; text-align: center; margin-top: 12px; } #menu li { display: inline; } #menu a { padding: 5px 19px; text-transform: uppercase; text-decoration: none; font-size: 12px; font-weight: bold; color: #FFFFFF; } #menu a:hover { background-color: #333333; } /************* CONTENT ************/ #content { width: 995px; margin: 0px auto; padding: 0px 0px 0px 0px; } #content h2, #content h3, #content h4, #content h5, #content h6 { font-weight: normal; } #content p, #content ul, #content ol { line-height: 150%; } #left { float: right; width: 680px; padding: 0px 20px 40px 20px; } #right { float: left; width: 230px; padding: 0px 20px 40px 20px; color: #99CCFF; } /************* FOOTER ************/ #footer { clear: both; width: 995px; margin: 0px auto; border-top: 1px solid #666666; background: red repeat-y center top; font-size: 9px; text-align: center; padding: 2px; color: #333333; } #footer2 { clear: both; width: 995px; margin: 0px auto; border-top: 1px solid #666666; background: blue repeat-y center bottom; font-size: 9px; text-align: center; padding: 0px; color: #333333; height: auto; } Ok, I have a gradient and i'm using it as the background for a <div> I want the whole background to show. So it's always dark at the bottom and light at the top. I have my image gradient.jpg and I want it to stretch or shrink vertially but repeat horizontally. Heres what I have: Code: <style type="text/css"> <!-- div { width: 50%; height: 50%; background-image: url(background.jpg); } --> </style> Like that it will only display half of the gradient if the gradient is longer than 50% of the page. I want it to stretch or shrink the image so that the whole gradient is displayed. I tried using the background-size: 100% attribute but it diddnt do anything :-\ Thanks for any help. Hi there, I'm having trouble (right now Im just trying to get firefox to work) getting my #content div to stretch completely vertically. The #main div is stretching correctly, I figured I'd be able to use the same code to get the #content div to stretch. TIA - Mark HTML Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>{$title}</title> <link rel='stylesheet' href='/css/core2.css' type='text/css' /> </head> <body> <div id="main" > <img src="/images/left_shad_top.png" id="left" alt="left shader" /> <div id="content"> test </div><!-- end of content --> <img src="/images/right_shad_top.png" id="right" alt="right shader" /> <div style="clear:both;"></div> <img src="/images/bottom.jpg" id="bottom"/> </div> <!-- end of main div --> </body> </html> My CSS Code: *{ margin: 0; padding: 0; } html{ background-color: red; } body{ height: 100%; background-color: blue; margin: 0 auto; } #main{ min-height: 100%; background-color: yellow; width: 850px; background-image: url( '/images/shad_repeat.png'); background-repeat: repeat-y; } #content{ width: 695px; background-color: green; min-height: 100%; float: left; background-image: url('/images/page.gif'); background-color: #dcdbdc; background-repeat: repeat-x; } #left{ float: left; } #right{ float: right; } #bottom{ margin-left: 50px; } i want to make a word Stretch across a givin width... when ever i set it to expanded, wider, or any of the others... nothing happens to the text.. does anyonw know how this works? I have a layout that has the normal four divs: Header Navigation Content Footer All of the divs are 775 px wide and are centered. The nav is a list of 6 links, and right now they take up very little space relative to the 775px they sit above. I would like them auto fit so that they take up all of the all of the 775px. If it is possible, I would like them to do correct depending on what is typed it, so that I'm giving each a specific px width. I've attached the HTML and the CSS that accompanies it. I'd post a link to a snapshot of it, but I can't post links yet. :x Any help would be greatly appreciated! HTML: Code: <div id="nav"> <ul> <li style="margin-left: 1px"><a href="/link1.html"><span>link1</span></a></li> <li><a href="/link2.html"><span>link2</span></a></li> <li id="current"><a href="/link3.html"><span>link3</span></a></li> <li><a href="/link4.html"><span>link4</span></a></li> <li><a href="/link5.html"><span>link5</span></a></li> <li><a href="/link6.html"><span>link6</span></a></li> </ul> </div> CSS: Code: body { background-color: #636c08; background-image: url(images/background.gif); background-repeat: repeat-x; } h1 { font: bold 18px Arial, Verdana, sans-serif; color:#630; } #container { margin: 0 auto; text-align: left; width: 775px; } #header { position:realtive; left:0px; top:0px; width:775px; } #nav{ margin-left: 4px; padding: 0; width: 100%; background: transparent; voice-family: "\"}\""; voice-family: inherit; padding-left: 5px; } #nav ul{ font: bold 16px Arial, Verdana, sans-serif; margin:0; padding:0; list-style:none; } #nav li{ display:inline; margin:0 2px 0 0; padding:0; } #nav a{ float:left; color: white; background: #87A00C url(images/leftcap2.png) no-repeat left top; margin:0 2px 0 0; padding:0 0 px 3px; text-decoration:none; letter-spacing: 1px; } #nav a span{ float:left; display:block; background: transparent url(images/rightcap2.png) no-repeat right top; padding:4px 9px 6px 6px; } #nav a span{ float:none; } #nav a:hover{ background-color: #C1CF2B; color: #000000 } #nav a:hover span{ background-color: #C1CF2B; } #nav #current a, #ddcolortabs #current span{ /*currently selected tab*/ background-color: #C1CF2B; color:#000000; } #topbar{ clear: both; padding: 0; width: 100%; height: 16px; line-height: 16px; background: #C1CF2B; } #content { background-color:#EAEEB3; padding: 8px; } #bottombar{ clear: both; padding: 0; width: 100%; height: 16px; line-height: 16px; background: #C1CF2B; } #footer { font: bold 9px Arial, Verdana, sans-serif; color:#FFF; text-align:center; } I would like the content table on the website to stretch as to the edges of whatever space it is taking up. But when I view the page, the table doesn't stretch vertically down until it hits the bottom edge. Any ideas? PHP Code: .content { height: 100%; width: 100%; } |