CSS - Variable Table Cellspacing?
I am constructing a table (needs to be table) where the first 2 columns of data need to have no spacing in between them. However I want the rest of the columns to have spacing of say 4px. Is this possible?
I cant create a table within a table to solve the problem either because all of the cells in the table are related. I tried setting the table to have no spacing and then applying margins to the cells i want to have margins, but no margins were applied. Any ideas? Similar TutorialsHi! I'm wondering what would the Cellpadding & Cellspacing be in CSS?? THanks, FletchSOD Hi I'm sure this is an easy one, but I can't figure out how to create a table style sheet that does exactly what the following html does Code: <table width="100" border="0" cellspacing="0" cellpadding="0" bgcolor="blue"> <tr> <td bgcolor="yellow"></td> </tr> </table> I tried many different variations using the table-specific keys documented here but am unable to achieve the above effect. What's happening is that the yellow background of the "td.outlineCollapsed" style (below) has a 1 pixel inset on all sides from the edges of the "table.outlineBase" style box. With the html, by contrast, the yellow background of the <td> exactly overlaps the blue background of the containing table. The exact overlap is what I'm trying to acheive. Could someone take a look and tell me what I'm doing wrong? Thanks Ken Here's the css: Code: table.outlineBase { background-color: #888888; width: 100%; height: 20px; /* tried all of the following in many different combinations. Nothing worked. border-style: hidden; border-collapse: collapse; border-spacing: 0px; border: outset 0px; border-spacing: 0px; border: inset 0px; */ } table.outlineBase:hover { cursor: pointer; } td.outlineCollapsed { background-color: yellow; width: 25px; height: 20px; } please check this page http://www.mueddat.com/index2.php i'm using in the table tag where the select input exist the following cellspacing attribute Code: <table width="97%" align="center" cellspacing="4"> why it doesn't appear in Mozilla Firefox? 2nd question How to change the color of the select box blue area (where the arrow is) from light blue to brown? i found selector "padding" but nothing which may be analog of cellspacing. Any directions? Is something conformable to cellspacing-color? Or can I have change cellspace color? Hi, At long last, I've managed to figure out how to emulate the HTML cellspacing attribute in CSS. So I thought that I'd post it here so everyone can use it. Here's the code: Code: .cellspacing td { border-right : 3px solid #FFF; } .cellspacing td:last-child { border-right : 0px; } .cellspacing th { border-right : 3px solid #FFF; } .cellspacing th:last-child { border-right : 0px; } Just add the cellspacing class to a table tag and it creates a white 3px border between each column throughout the table. It's a shame the CSS designers haven't made this easier by having a proper built-in cellspacing attribute, but until they do, this is the next best thing, I guess. Enjoy. Debbie what is the equivilant to <table border="1" cellpadding="2" cellspacing="0"> in css? i've tried PHP Code: table { border-spacing: 0px; padding: 0px; border-colapse: colapse; border-style: solid; border-width: 1px; } td { border-style: solid; border-width: 1px; padding: 2px; } That makes the width 2px wide though. I want it to only be one. And the padding seems to be messed up as well. Hello all, I am encountering a minor bug working on a page, and it is driving me insane. Anyway, I have a table organized as such: <table height="100%" border="0" cellpadding="0" cellspacing="0"> . . . </table> Now, I wanted to convert this to use CSS so that it would be HTML 4.01 compliant. So, I used a CSS document outlined like so: .maintable { padding: 0px; border-spacing: 0px; border: 0px; height: 100%; } and then changed my main code to this: <table class="maintable"> . . . </table> Anyway, the height and border seem to be "moving over" fine, but it is clear to me that the padding and spacing are not. In any browsers that I use, I get an output as if padding and spacing were set to default values... I tried using the collapse method, that failed to. I usually miss minor things, so what is my stupid error? Thanks Is there a way to override CSS padding to use cellpadding instead or can inheritance be prevented? I have a CMS and I want editors to still be able to use the cellpadding attribute rather than make a class for each desired padding. I am not able to set a defining ID or class on the table as it's generated with our CMS. The relevant tables are contained in a defined parent class. Code: TD{ padding: 0px; } .custom TD{ /*padding: ignore;*/ } Code: <span class="custom"> <table cellpadding="5"> ... </table> <span> Hey guys, I'm having trouble with the cellpadding on a "tab" on my page. I've got a div that has a table with a single cell inside it. The table is left justified in the div and has a black background. I can't give the table cell a fixed width because a word of variable length will appear inside it. The text in the cell appears aligned center and valigned middle, with 10 pixels of padding on the left and right sides. This appears exactly right in every browser but IE 6 on Windows, where the left and right padding is lost, and the word is bumped right up to the edge of the black table cell. How can I fix this? Thanks a lot. Here's the page: http://aoi2.keysandwings.com/about.php Here's the HTML: Code: <div class="relativetitle""> <table class="titletable"> <tr> <td align="center" valign="middle">About</td> </tr> </table> </div> And here's the CSS: Code: .relativetitle { position: relative; margin-left: auto; margin-right: auto; z-index: 1; width: 682px; height: 30px; color: white; background: transparent; font-size: larger; text-align: left } .titletable { height: 100%; padding-left: 10px; padding-right: 10px; background: black } hi, i'm designing my page and i would like my tables to look similarily as Dev Shed Forums table in the "main menu" (the starting page). i cannot find out how this is done: the first table row uses cellspacing, the second row doesn't use it and the third row uses it again. (where 1st row is where "Forum,Last Post,Threads,Posts" is written, 2nd with "Programming Languages" and 3rd with "PHP Development") well, maybe it's not done this way at all (i tried to decode the HTML code but it was too complicated for me), but i would like to ask if it can be done somehow this way (eg: to define a table with cellspacing and then override this setting in one specific row with some CSS rule) or i have to use more tables to achieve this effect? it came in to my mind when i saw something similar in the Dev Shed Forum's HTML code: Code: <td style="padding: 0px;"> is there something similar which influences cellspacing? thank you I have a textarea in a <td>which asks for users for some description. If users enter text and don't use any space or enter, the width of the table gets bigger and bigger and damages the pages design. What can I add (to td.fixed_width css for example )to make the line break after the width of the table is reached??? There is a solution that I put a div in td and then Code: #desc { width:"100%"; width::fixed; overflow:scroll;} but it is not exactly what I want hi every one... How can I display static headers in a table, so that headers remain visible while user scrolls the table body? This is not working in IE 7 any working example please 2. iam having a column which holds data around some 100 to 200 characters... by default i want to display some 50 characters and rest of the characters can be viewed by moving the column... if this is possible let me know how to do it with some sample code......i dont know much about CSS 3. One more problem iam facing is with the number of columns displayed in the table. I have to display around 15 to 20 columns in a table... with this 15 to 20 columns in a table, i can see scrollbar to the page ....but i dont want scrollbar to the page, instead i want want scroll bar to the table (so that it doesnot effect the design of the page) I need a fixed table width and height and also fixed column width and height..... Note: I dont mind if columns are not visible (thru scrool bar i should see the hide columns) Alright, this is probably a simple fix but I can not find the solution anywhere. I'm trying to highlight a table cell with a 2px solid red border when it is clicked. Is there a way to get this to happen with out changing the size of the cell? I hope this makes sense. Basically the cell is expanding by 1 px causing movement in the table. -------------------------------------------------------------------------------- Hello, Not exactly sure where to post this question... but: I'm having a bit of trouble keeping a table at a fixed height. What I have is a Small 200x80px table above my an input form. As users type data into the input form, javascript code dynamically updates the contents of the table. I have the table width properly fixed, and the input fields have character limitations... however if a user inputs a lot of capital letters or other wide characters, the table automatically increases in height when the text wraps. It's pretty much necessary that the text wraps for the middle lines of the table, and on the other two lines I have used the javascript to remove wrapping, but I never want the table to grow longer than 80px no matter how much is typed in the fields. Is there a way that I can constrain the table height? Thanks in advance! I'm trying to get a table inside another table which completely fills the parent table, but I cannot get it to work. The simple piece of code illustrates my problem. The red table is inside the blue table but does not cover the entire cell from top to bottom, but only the centre. I want this table to be streched. Obviously height: 100% doesn't work. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"> <html> <body> <table> <tbody> <tr> <td> 1<br>2<br>3<br>4<br>5<br> </td> <td style="background: blue;"> <table style="height: 100%; background: red;"> <tbody> <tr> <td style="vertical-align: bottom"> Test </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </body> </html> I have a dynamic table that is in the cell of another table. For the life of me I cant get it to stick to the top of the cell. It wants to sit at the midline of it vertically. Thanks for reading. hi all ! Im having a little bit of problem to make a header and the table body match in a correct way. My header is declared as <table align="center" class="style36" id="header"> and the CSS controlling it is Code: table.style36 { width: 1000px; vertical-align:middle; } .style36 td{ font-family: Arial, Helvetica, sans-serif; font-size: 12px; vertical-align:middle; } And the table wich is declared as Code: <div class="scrollingDiv"> <table border="1" bordercolor="#000000" align="center" bgcolor="#FFFFFF" class="style13" id="tableBody" > And the CSS controlling it Code: div.scrollingDiv { height:420px; overflow:scroll; vertical-align:middle; width:1024px; } table.style13 { width: 1000px; vertical-align:middle; } /* Since the table has a class of style13, all td elements under that style can be selected as below... no need for more style definitions... */ .style13 td { vertical-align:middle; } .style13 th { vertical-align:middle; } My first idea was to declare a width for each td, something like: Code: <td width="30" bgcolor="#${color2}"><div align="center">${fila.sHoraent_Citas}</div></td> <td width="120" bgcolor="#${color2}"><div align="center"><a href="SvMedPro?boton=Info&idPaciente=${fila.idPaciente_Citas}">${fila.nom_Paciente}</a></div></td> AND match the header too, dosent seem to work, Im pretty new to web programing so any help is appreciated. Thanks! Hi all, what i want is to customise the borders of a table... i know that <div>'s can have custom borders but, for the way that the page works i used table tags <table>. (very little experience of using <div>) is there a way that css can manipulate the borders of a table? i tried using this css: .nmhead { border-color:#cccccc; border-top:border-top-style:none; border-left:border-left-style:none; border-right:border-right-style:double; border-bottom:border-bottom-width:5px; } and then in the table doing this: <td class='nmhead'> but it didnt work (attached is what i want it to look like) any ideas? Hi, CSS whizz needed! I'm currently formatting a pre-determined HTML website using CSS. The website has been formatted with ID's for all tables and cells so I can specify which colour I'd like the background of the cells. The HTML is like this: Code: <table id="Description"> <tr><th class="title">Text</th></tr> <tr><td class="data"><div class="ggcode">Text</div></td></tr> </table> So I've been formatting it like this: Code: div#Main table#Description .title { border-color:#F0E68C; background-color:#F0E68C; } div#Main table#Description td.data { border-color:#F0E68C; background-color:#F0E68C; } However the last table is like this: Code: <table id="recentPosts"> <tr> <th class="title"> Recent Forum Posts </th> </tr> <tr> <td> <table class="data"> <tr> <th>Topic</th> <th>User</th> <th>Posted At</th> </tr> <tr> <td class="clickable forumTitle"><a href="link">Text></td> <td class="username">Text</td> <td class="date">Text12/04/2009 03:25 PM</td> </tr> <tr> <td class="clickable forumTitle"><a href="link">Text</a></td> <td class="username">Text</td> <td class="date">Text</td> </tr> </table> </td> </tr> </table> I'm able to format the cells within the <table id="recentPosts">, but I can't alter the cells within <table class="data"> - the table within the table. Any ideas how I would go about doing this? Thanks in advance |