HTML - Centering A Picture In A Table Cell
Hi guys,
I'm rather a n00b at html, and I'm sort of learning as I go while I help fix up a site that wasn't updated since 2006. I'm setting up a "Contact Us" page, and are rearranging the staff photos so that the CEO is in his own seperate table, up the top, and in the centre of the row. Then, below him, I'm hoping to put his secretary, the treasurer and the marketing person. The managers need to go under them, and work downwards. At the moment, here's what I've got: Code: <table border="1" width="100%"> <tr> <td width="33%"> </td> </tr> <tr> <td width="100%"> <dive align="center"><img src="xxxxx.gif" width="165" height="147"></div> </td> </tr> <tr> <td width="33%"> <div align="center"><a href="mailto:xx@xxx.xxx">Xxxx Xxxxx - Chief Executive Officer</a></div> </tr> </table> . The table below this is rather severely outdated, and I haven't done much work on it, so there's not much point posting it here. The problem is that the picture of the CEO is left-justified in the cell, rather than being right in the (horizontal) centre of the page. Any ideas? Thanks a lot guys. Cheers, Franklint Similar TutorialsHi, I'm having a bit of a problem with my table. A cell which should completely be filled with a picture leaves a small - but - whitespace between the picture and the next cell. I've posted a pic of the problem and here comes the code: <table border="0" cellspacing="0" width="780" align="center"> <tr> <td height="250" width="780" colspan="3"> <img src="pics/Kjolur.png" height="250" width="780"> </td> </tr> </table> <table border="0" cellspacing="0" align="center" style="background-color: white;"> <tr> <td height="750" width="194"> <table border="0" cellspacing="0" cellpadding="0" style="background-color: #f0f0f0; border-left: 4px solid #f0f0f0;"> </tr> <tr> <td class="sub1" height="10" width="190"> </td> </tr> <tr> <td class="sub1" height="27" width="190" style=" border-bottom: 1px solid darkgray;"><a href="http://www.kerlingarfjoll.is/information.html">Information</a> </td> </tr> .... etc. I've quite new to this and find myself a bit at a loss, so any help would be soo much appreciated!! Best, thora Hello, I am very new to HTML, so I could use any help I can get right now. I am making a website for a project in my computer class and I am having issues with my pictures and cells. In Firefox my pictures show up but my text gets cut off at the bottom of the cell...(I didn't want to mess with frames this time because they confuse me, that's why I used a table instead). In IE6 the pictures don't show up but all of the text is shown in the cell...here is a link to my 'homepage' if you want to see what I am talking about...or if anyone wants to give me advice. icarus.uic.edu/~speter20/areorg/index.html Also, my professor wanted one of our pages to be of "bad style," which is why the first page you see is so bad. Just wanted to let you know that. ANY help at all is GREATLY appreciated!!! Thanks, Stephanie Hi everyone: Any help appreciated. Objective: To have three equally sized and spaced images arranged horizontally, with their size set automatically by the size of the window. Development: I'm using a Mac, and I don't have ready access to a PC to experiment. What I tried: Code: <table> <tr> <td><img src = "a.png" style = "width: 100%" /></td> <td><img src = "b.png" style = "width: 100%" /></td> <td><img src = "c.png" style = "width: 100%" /></td> </tr> </table> <p class = "caption">A caption for the 3 images</p> <p class = "legend" >A legend for the three images</p> What happened: This works perfectly in Safari and Firefox (Mac) and Firefox under Vista, but in Internet Explorer under Vista , the images are HUGE - the unscaled size of the originals. What I think is the reason: IE is taking 100% to be relative to the width of the body element, not the td element. What I don't want to have to do: Use fixed sizes or calculate the sizes on the fly. What I'm trying now: removing the table and using a div, and inside that, setting the image width to 33% and floating one right and one left. What's the trick to get around this IE "gotcha" please? Thanks from a newbie. hi, i have a jsp page, in this page i am displaying data retrieved from mysql database. Now the problem is i must color table cell based on cell value. how to implement this.please give me an sample or working code foe this problem.( any code is accepted) preferably html or javascript. i.e if cell value is "late" then display that cell in red color else display the cell in green color please help me. Thanks ad Regards Akash The table itself is working fine, but the size of each cell is not correct in Firefox. Here is a screenshot of what is happening: http://img35.imageshack.us/img35/1938/tabletroubles.gif Here is the head of my page, the css for the table is he HTML Code: <style type="text/css"> #cat table {border:0px solid #333333; cell-padding:0; cell-spacing:0; align=center} #cat tr {align=center} #cat td {font-size: 13px; font-family=tahoma; font-weight: bold; padding: 0px; border:0px solid #333333; align=center;} #cat td a {text-decoration: none; color:#757575; background-color: white; display:block; height=23; background-image: url(linkbg1.gif); align=center;} #cat td a:hover {background-color: #333333; font-weight: bold; text-decoration: none;color: #ffffff; background-image: url(linkbg2.gif); align=center;} </style> and here is the table code, located in the body of the page: HTML Code: <div style="Height:53px; overflow:auto; width:900px; position:absolute; top:0; left:0"> <TABLE bgcolor=#333333 cellspacing=0; cellpadding=0;><tr><td> <div id="cat"> <table width=900; cellpadding:0px; cellspacing:0px> <tr align=center> <td width=20%> <font face=tahoma><a href="home.html">Home</a></font> </td> <td width=20%><center><font face=tahoma><a href="openings.html" target="_top">Openings</a></font></center></td> <td width=20%><center><font face=tahoma><a href="dance.html" target="_top">Dance</a></font></center></td> <td width=20%><center><font face=tahoma><a href="projects.html" target="_top">Projects</a></font></center></td> <td width=20%><center><font face=tahoma><a href="vocaloid.html" target="_top">Vocaloid</a></font></center></td> </tr> <tr> <td width=20%><center><font face=tahoma><a href="fanflashes.html" target="_top">Fanflashes</a></font></center></td> <td width=20%><center><font face=tahoma><a href="caramelldansen.html" target="_top">Caramelldansen</a></font></center></td> <td width=20%><center><font face=tahoma><a href="cosplay.html" target="_top">Cosplay</a></font></center></td> <td width=20%><center><font face=tahoma><a href="endings.html" target="_top">Endings</a></center></td> <td width=20%><center><font face=tahoma><a href="anime.html" target="_top">Anime Episodes</a></font></font></center></td> </tr> </table> </div> </td></tr></table> </div> A table is nested within another table. The table on the outside has no content, it is there to make a gray border around everything else. If you look at the table in firefox & internet explorer, you'll see that in IE- the table is much thicker than in firefox. How can i make it so that the table in Firefox will have the same thickness as the one in IE? I could really use some help. Thanks! What i want is an html table with 9 rows and 3 columns the first row is merged into a single cell with NAME in the rest of the first columni is to be merged into a single cell with a picture in i want the picture to be tight in the cell, no whitespace above, below or on the sides i want the bottom 8 rows (all of them except the header) to be the same height i'm nearly there but the bottom eight rows aren't all the same height. I'd prefer to do it using % rather than pixels if possible, i tried setting the first row to be 20% of the row height and the other 8 rows to be 10% but it didn't work any help appreciated, thanks Code: <body bgcolor=EEEEEE> <div align="center"> <!-- table with pic and summary data in --> <TABLE BORDER="2" CELLPADDING="2" CELLSPACING="2" cellalign="center" WIDTH="800"> <tr bgcolor="DarkGrey" height="20%"> <th width="100%" colspan = "3"> <font size=8 face="trebuchet MS"> NAME </font> </th> </TR> <TD rowspan="9" align="center" width = 20%><img width = 100% src="c:/test.bmp"/> </TD> <TR> <TD width = 40%> <font size=4 face="trebuchet MS"> TEST </font> </TD> <TD width = 40%> <font size=4 face="trebuchet MS"> TEST </TD> </TR> <TR> <TD width = 40%> <font size=4 face="trebuchet MS"> TEST </font> </TD> <TD width = 40%> <font size=4 face="trebuchet MS"> TEST </font> </TD> </TR> <TR> <TD width = 40%> <font size=4 face="trebuchet MS"> TEST </font> </TD> <TD width = 40%> <font size=4 face="trebuchet MS"> TEST </font> </TD> </TR> <TR> <TD width = 40%> <font size=4 face="trebuchet MS"> TEST </font> </TD> <TD width = 40%> <font size=4 face="trebuchet MS"> TEST </font> </TD> </TR> <TR> <TD width = 40%> <font size=4 face="trebuchet MS"> TEST </font> </TD> <TD width = 40%> <font size=4 face="trebuchet MS"> TEST </font> </TD> </TR> <TR> <TD width = 40%> <font size=4 face="trebuchet MS"> TEST </font> </TD> <TD width = 40%> <font size=4 face="trebuchet MS"> TEST </font> </TD> </TR> <TR> <TD width = 40%> <font size=4 face="trebuchet MS"> TEST </font> </TD> <TD width = 40%> <font size=4 face="trebuchet MS"> TEST </font> </TD> </TR> <TR> <TD width = 40%> <font size=4 face="trebuchet MS"> TEST </font> </TD> <TD width = 40%> <font size=4 face="trebuchet MS"> TEST </font> </TD> </TR> </table> Hi everyone. So I got my template set up to the way I like it and everything is rolling good. I inserted a picture into one of the cells in the table and it shifts everything over. Here is my code: <td width="625" colspan="1" bgcolor="white"> <font type="Arial" size ="5" color="blue"> <b>Floorplan</b><br> <center> <a href="floorplanlarge.jpg"><img src="floorplansmall.jpg" border="0" /></a> </center> </td> I have been working on fixing this for the last hour and am out of ideas on what is going on. The picture is smaller than the cell width range. My picture width is 311 pixels and the cell width is 625 pixels. I dont know if there is code whether its HTML or CSS to prevent the cell from widening. Any help would be appreciated. Also if you need me to provide more detail I can. Thanks. I have (for my sins - should have read up on css earlier) a table-based site, essentially with header, footer, left and right cells and the main piece in the middle. I have used different background colours, but am wanting to highlight the middle bit. I have used a border, but that seems to centre on the edge of the cell - ie half the specified border size is inside the cell and half outside. The effect of this is that my two side pieces have whitespace before they start. Is there any way to specify a 'border' which stays totally within its relevant cell ? Thanks. Hi Guys, Code: <td><a href="#" onclick="javascript:document.forms['formStatement'].submit()"> <%= statement.getTransaction().get(i).getTransactionId()%></a></td> As u see above is cell of a table, I want to fetch the value of the row cell as i want to use it using request object like req.getAttribute("some attribute"); How can i do that? I recently made a rollover menu, and though the text does highlight when I roll over the cell, the link only works if I rollover the word is the cell. Is there a way to make the cell itself link? Code: <td class="row5" style="text-align:center;" width="50"> <b style="font-size:15px; color:#c9c5be; font-family:Georgia;">2</b> <span style="color:#c9c5be;">topics</span> <br /> <b style="font-size:15px; color:#c9c5be; font-family:Georgia;">1</b> <span style="color:#c9c5be;">posts</span><br /><br /> </td> I'm not sure how it's looking in IE, but in Firefox all the text in this table cell is aligned to the right. I can't figure out why. Row5 only adds a background color and nothing else. http://sa.zrkonium.net/ It's visible here ^ The grey topics/posts text is aligned to the right in Firefox rather than in the center where it should be. I can't figure out why it's not aligning right. Any help appreciated. i want the entire table cell to be the link, not just the text inside any ideas? Hello all! I wanted to ask if there is a way to specify certain width sizes for table cells in a table. The thing is that I have a table in one webpage that, if I leave the width of the TD cells unspecified, I usually end up with some cells being very wide because the text that is written inside them is very big and does not roll up automatically and other cells shrink and become very small in order for the total table not to lose its specified length. Can I set a specific width for the cell that gets filled with many words so that the contents of this cell will wrap and not extend so much? Thank you! i want to open a frame by clicking on a cell,i can only do this when the ref is outside the table,can you help? Thanks everybody I've got a small problem, i want to make a table cell that works as a button. I tried it this way: Code: <table border='1' width='100%' height='10%'> <tr> <a href='page.htm'> <td width='20%' height='100%'> </td> </a> But this won't work, does anybody know how I can solve this problem? Hello, I have a problem with tables cells containing form buttons: Code: <tr> <td colspan="2" align="center"> <button id="button-submit_2" type="submit">Add Name</button>      </form> <form action="nrt-home-edit&delete.php" method="post"> <input type="hidden" name="class_name" value="$class_name[0]"/> <button id="button-submit_2" type="submit">Finish</button></form> </td> </tr> The above code puts the two buttons on their own lines within the table cell. My question is, does anybody know how to keep them on the same line without putting them into their own individual cells? I am doing a simple calendar. I managed to do the table with days etc. I have a problem I wish to highlight a number and the cell automatically according to the date of the day. Can Someone help please? Thanks & best regards Hi Can someone please tell me how I can make a table cell (which contains text which is linked) linkable? http://www.revolution.worldclanleagu...?site=calendar Here you can see a calendar with months at the top. When you hover over a month, the cell highlights but only the text inside is actually selectable - I'd like to make the cell selectable/linked. PHP/HTML I have: Code: <td class="calendar-month" align="center"><a class="calendar" href="index.php?site=calendar&month=01">'.mb_substr($_language->module['jan'], 0, 3).'</a></td> CSS: Code: a.calendar, a.calendar:visited, a.calendar:active { font-family: Arial; color: #dbdbdb; font-size: 11px; line-height: 13px; text-decoration: none;} a.calendar:hover { font-family: Arial; color: #dbdbdb; font-size: 11px; line-height: 13px; text-decoration: none;} .calendar-month, calendar-month:visited { font-family: Arial; color: #dbdbdb; font-size: 11px; line-height: 13px; padding: 5px; background-color: #2f2f2f; border-bottom:3px solid #1d1d1d; border-right: 1px solid #000; border-top: 1px solid #424242; border-left: 1px solid #424242;} .calendar-month:active { font-family: Arial; color: #dbdbdb; font-size: 11px; line-height: 13px; padding: 5px; background-color: #2f2f2f; border-bottom:3px solid #1d1d1d; border-right: 1px solid #000; border-top: 1px solid #424242; border-left: 1px solid #424242;} .calendar-month:hover { font-family: Arial; color: #dbdbdb; font-size: 11px; line-height: 13px; padding: 5px; background-color: #3f3f3f; border-bottom:3px solid #1d1d1d; border-right: 1px solid #000; border-top: 1px solid #424242; border-left: 1px solid #424242;} (sorry theres so much css) Thanks in advance =D |