CSS - Image Alignment Inside <td>
Hi.
K, I have NO idea where to begin on this one. I need to display a series of thumbnails (to be selected dynamically from a database) inside 1 <td> tag. I need them to be organized 3 wide by 3 high, with their titles underneath. What would I use for this? I"m assuming I just set up a new class for that, but I don't know what to do for it. Any help is greatly appreciated. Similar TutorialsHi guys, I was hoping someone could help? I have the following css which controols the style for a larger image on hover function. (thumb - then large pic on hover) I am having trouble positioning (vertically) the image, what can I usew to control it? Code: /* Popup Image Viewer */ .thumbnail{ position: relative; z-index: 0; } .thumbnail:hover{ background-color: transparent; z-index: 50; } .thumbnail span{ /*CSS for enlarged image*/ position: absolute; background-color: #669933; padding: 1px; left: -1000px; border: 1px ridged; visibility: hidden; color: black; text-decoration: none; } .thumbnail span img{ /*CSS for enlarged image*/ border-width: 0; padding: 2px; } .thumbnail:hover span{ /*CSS for enlarged image on hover*/ visibility: visible; top: 0; left: 135px; /*position where enlarged image should offset horizontally */ } hi i am trying to position some images in this box... #rightColumn { float: right; padding: 0px; margin:0 12px 0 15px; background: #F2FCFF; width: 350px; } there are 3 images and i wany them to go from left to right accross the box using this tutorial as inspiration. however, rather than use margins to space the images (this screws up what i am trying to achieve) i wanted to use css alignment i.e. leave the first image alone, centre the second and align right the third. I can't figure how to do it though... i've tried a couple of things but i still pretty wet behind the ears so don't have too much experience to draw upon.... i tried <div class="button"><img src="images/school-uniform-button.gif" alt="school uniforms" name="uniform" width="107" height="107" id="uniform"><div class="centre"><img src="images/school-equipment-button.gif" alt="classroom equipment" name="equip" width="107" height="107" id="equip"></div> <div class="jumpmenu"><img src="images/fees-button.jpg" alt="School fees" name="fees" width="107" height="107" id="fees"></div></div> and also with the <div class="button"> next to each image with the alignment divs. neither works and advice would be really appreciated thanks jim. I'm really hung up on what class alignments I need to alter in order to get my thumbnails to align properly. If my thumbnails span the width of my page width, they are justified, but if they do not, they align left. The forum isn't letting me post a link to an example, but my website is at www dot the312hole dot com. The latest post shows an example of what I'm talking about with the thumbnails at the bottom of the post. Any advice on how to get them to always space evenly? Preferably with a predefined margin and padding that spaces them equally regardless of how many are in each row? Thanks for the help! Okay, I'm no newbie on using CSS but the long story short is that I bought software for a shopping cart and had to use their pre-made template in order to keep the peace. I of course, being a web designer changed the template to my own liking, but can NOT get this header centered for the life of me! I have tried everything I know, including things I have looked up, nothing will work. Here is the main.css (only css file being used) Code: body { color: #ffffff; background-color: #000000; font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; text-align: left; margin:auto; text-align:center; margin:0 auto; } a { color: #d92f2f; font-weight: normal; text-decoration: underline; cursor: pointer; } p { margin: 0px 0px 7px 0px; } sup { display: inline; padding: 0px; vertical-align: super; font-size: 8px; } a:hover { color: #ffb4b4; } legend { display: none; } label { display: none; } fieldset { border: none; padding: 4px 0px 4px 5px; } fieldset p { display: block; margin: 5px 5px 5px 2px; } form { margin: 0px 0px 5px 0px; } img { border: none; } li { padding-bottom: 5px; } /* +------------------------------------------------------------+ */ /* | General XHTML Classes | */ /* +------------------------------------------------------------+ */ .center { text-align: center; } .inlinecenter { text-align: center; } p.inline { display: inline; padding: 0px; } .strong { font-weight: bold; } .big { font-weight: bold; font-size: 16px; } .hidden { display: none; } a.unfancy { color: #d92f2f; font-weight: normal; text-decoration: underline; cursor: pointer; } /* +------------------------------------------------------------+ */ /* | Skin Specific Divs | */ /* +------------------------------------------------------------+ */ #skin_header { height: 230px; width: 899px; margin:auto; padding: 0px; background-position: center top; } #skin_wrapper { width: 910px; padding: 0px; margin:auto; } #skin_wrapper_full { width: 100%px; padding: 0px; margin:auto; background-image: url('../media/header.png') background-repeat: repeat-x; background-position: top left; } #skin_ct { width: 100%; padding: 0px; margin: auto; border-spacing: 0px; border-collapse: collapse; } #skin_ct_lcol_head { font-size: 16px; font-weight: bold; padding: 10px; margin: auto; width: 160px; height: 80px; } #skin_ct_rcol_head { font-size: 16px; font-weight: bold; padding: 10px; margin: auto; height: 80px; text-align: right; } #skin_ct_lcol { padding: 20px 10px 10px 10px; margin: 0px; vertical-align: top; width: 160px; text-align: left; } #skin_ct_mcol { padding: 20px 10px 10px 10px; margin: 0px; vertical-align: top; line-height: 150%; } #skin_ct_rcol { padding: 2px 10px 10px 10px; margin: 0px; vertical-align: top; width: 160px; } #skin_footer { color: #FFFFFF; background-color: #000000; padding: 50px 10px 10px 10px; margin: 0px; text-align: center; background-image: url('../media/footer.png'); background-repeat: repeat-x; background-position: top left; } #skin_pgtitle { font-size: 16px; padding: 0px 0px 4px 0px; margin: 0px 0px 10px 0px; font-weight: bold; border-bottom: 1px solid #999999; } #skin_content { margin: auto; } There is more coding but the actual image header is located inside of the #skin_header. Also, here is the PHP code where the SRC code is located: Code: </head> <body> <div id="skin_header" align="center"> <img src="skins/Default/media/logo.png" alt="Home" width="899" height="230" align="center" style="margin:auto;"/> </div> <div id="skin_wrapper_full"><div id="skin_wrapper"> <table id="skin_ct"> <tr> <td id="skin_ct_rcol_head" colspan="3"> <div id="skin_menu_head"> <ul> <?php if (!(empty($link_home))) {print '<li><a href="' . $link_home . '" title="Home">Home</a></li>';} if (!(empty($link_cart))) {print '<li><a href="' . $link_cart . '" title="Shopping Cart">Shopping Cart</a></li>';} if (!(empty($link_checkout))) {print '<li><a href="' . $link_checkout . '" title="Checkout">Checkout</a></li>';} if (!(empty($link_account))) {print '<li><a href="' . $link_account . '" title="Your Account">Your Account</a></li>';} if (!(empty($link_contact))) {print '<li><a href="' . $link_contact . '" title="Contact">Contact</a></li>';} ?> </ul> Please, ANY help would be appreciated, I want to get this site live, pronto. The link is www.PhantomSupplements.net thank you! Hi There, If you put images in in replacement for standard form buttons they don't align properly. I have been trying to move away from nested tables with my current work in favour of css layouts and was wondering if there is any quick and easy way to align button images? If you look at the following URL the 'add to basket' buttons are higher up thean they should be..... http://www.storesprite.org/taml/vie...l?category_id=3 Thanks Nevermind, folks over at codingforums helped me. I'm trying to get something that looks like this: Here is the xhtml: Code: <div id="container"> <div class="design_box"> <img src="images/image.png" alt="" /> <h1>Header goes here</h1> <p>Paragraph goes here</p> </div> <div class="design_box"> <img src="images/image.png" alt="" /> <h1>Header goes here</h1> <p>Paragraph goes here</p> </div> <div class="design_box"> <img src="images/image.png" alt="" /> <h1>Header goes here</h1> <p>Paragraph goes here</p> </div> </div> Here is the relevant css: Code: .design_box { display: block; margin-bottom: 17px; } #row_a_right_web_design img { float: left; } .design_box h1 { color: #fbfbfb; font: bold .9em Tahoma, arial, sans; margin-bottom: 4px; } .design_box p { color: #c4c2c2; } Needless to say, the above css does not produce the desired outcome. I'm having a serious brain-fart as to what the best way is to tackle this. Thanks in advance. This post can be deleted, I solved my problem. hi i have following xhtml Code: <body> <div id="content" class="centrehack"> <div id="header" class="centrehack"> <div id="topRightLogin"> <form action="#" method="post"> <input type="text" name="uname" value="username" /> <input type="password" name="passwd" value="password" /> <input type="image" src="images/headerlogin.gif" /> </form> </div> and following css Code: .centrehack { margin: 0 auto 0 auto; } #content { width:960px; text-align:center; height:100%; overflow:visible; background:url(images/headerback.gif) repeat-x; } #header { width:960px; height:47px; text-align:center; } #topRightLogin { width:450px; height:47px; float:right; color:#fff; font-weight:bold; font-family:Verdana, Geneva, sans-serif; border:#000 solid 1px; height:30px; display:block; padding:0; } #topRightLogin input,submit { display:inline; padding:0px; margin-left:5px; height:21px; margin-top:0px; } i want to display form fields and submit button in a single line with perfectly aligned horizontally. but the form fields are showing empty area above them and going down than the submit button. the problem remains same in all browser. i am attaching a screenshot of the problem as well. any help is much apprecated. thanks Hello all, I am trying to make a horizontal nav bar using a list. Everything was going good until I tried to add an image (essential a line) to seperate each <li>. When I did this, the height of the nav bar expanded and it moved the entire list down about 15 pixels or so. I am attaching an image before I added the image and after I added the image to show. Here is my css code for before I add the image: PHP Code: #navbar { height:37px; line-height:33px; padding: 2px 0 0 10px; vertical-align:top; background: url(images/linkbarbg1.png) repeat-x; font-family: Tahoma, Georgia, "Times New Roman", Times, serif; font-size: 18px; color: #FFFFFF; } #navbar ul { vertical-align:top; margin:0; padding:0; border: 0px solid #000000; } #navbar ul li { display: inline; } #navbar ul li a { display: inline; text-decoration: none; padding-top: 5px; padding-bottom: 4px; padding-right: 10px; padding-left: 10px; color:#FFFFFF; } #navbar ul li a:hover { height: 31px; background:url(images/linkbarbg1hover.png) repeat-x top left; background-color: #FF3300; } And HTML: PHP Code: <div id="main"> <div class="leftshadow"> <div class="rightshadow"> <div id="header"><img src="images/logo1.png" /></div> <div id="navbar"> <ul> <li><a href="#">Milk</a></li> <li><a href="#">Eggs</a></li> <li><a href="#">Cheese</a></li> <li><a href="#">Vegetables</a></li> <li><a href="#">Fruit</a></li> </ul> </div> </div> </div> And here is what it looks like: My CSS Code is the same for after, here is my HTML code for after: PHP Code: <div id="main"> <div class="leftshadow"> <div class="rightshadow"> <div id="header"><img src="images/logo1.png" /></div> <div id="navbar"> <ul> <li><a href="#">Milk</a></li> <li><img src="images/linkbarseperator1.png" /></li> <li><a href="#">Eggs</a></li> <li><a href="#">Cheese</a></li> <li><a href="#">Vegetables</a></li> <li><a href="#">Fruit</a></li> </ul> </div> </div> </div> and here is what is looks like: Is there a way to fix this? UPDATE I have noticed the same thing happens even when it is not a list. Therefore, it must be due to some other factor...does anyone have any ideas? Sounds simple... but I can't find an answer. I've a simple table row with a css background image. In the row I've my text links and two images that are links. While in firefox everything lines up nice and straight... in intercrash exploder it's all over the place, the images are almost subtext and the text is almost text top.. Any advice? The page can be seen at addcolour (co uk extension) CSS in a folder css the file name is addcolour Many thanks d I'm trying to have a logo in a div next to a navigation menu that can align at a specific height in my logo. but im having a problem with my li background images staying within the ul background image. Can someone help me fix my code to align this properly? HTML CODE: 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=utf-8" /> <title>Untitled Document</title> <link href="style.css" rel="stylesheet" type="text/css" /> <!-- load the typeface.js library and typeface.js fonts --> <script src="js/typeface-0.14.js"></script> <script src="fonts/haettenschweiler_regular.typeface.js"></script> </head> <body class="oneColFixCtrHdr"> <div id="container"> <div id="header"> <div id="navigation" class="menu"> <ul id="top-nav"> <li class="item4"><a href="#" title="Contact">Contact</a></li> <li class="item3"><a href="#" title="About">About</a></li> <li class="item2"><a href="#" title="Ideas">Ideas</a></li> <li class="item1"><a href="#" title="Portfolio">Portfolio</a></li> </ul> </div> <div id="logo"><span><a href="http://www.nadesignstudio.com/" title="NA Design Studio" rel="home">NA Design Studio</a></span></div> <div class="clear"></div> <!-- end #header --></div> <div id="mainContent"><h1 class="typeface-js">Main Content </h1> <div class="typeface-js"> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam ante ac quam. </p> </div> <!-- end #mainContent --></div> <div id="footer"> <p>na design inc, new york :: all right reserved 2010</p> <!-- end #footer --></div> <!-- end #container --></div> </body> </html> CSS CODE: Code: body { font: 100% Verdana, Arial, Helvetica, sans-serif; background: #FFFFFF; margin: 0; padding: 0; text-align: center; color: #FFFFFF; } .oneColFixCtrHdr #container { width: 800px; background-image: url(images/bg-stripe.png); background-repeat: repeat; margin: 0 auto; border: 1px solid #000000; text-align: left; } .oneColFixCtrHdr #header { padding: 10px 10px 0 10px; background: #000000; } .oneColFixCtrHdr #header h1 { margin: 0; padding: 10px 0; } .oneColFixCtrHdr #mainContent { padding: 0 10px; } .oneColFixCtrHdr #footer { padding: 0 10px; background: #000000; font-family: "Courier New", Courier, monospace; font-style: italic; font-size: 8pt; } .oneColFixCtrHdr #footer p { margin: 0; padding: 10px 0; } .typeface-js { font-family: Haettenschweiler; font-style: italic; letter-spacing: 1px; color: #FFFFFF; } #logo { display: inline; float: right; text-align: left; } #logo a{ background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(images/logo.png); background-origin: initial; background-position: 0 0; background-repeat: no-repeat no-repeat; display: block; height: 118px; margin-bottom: 10px; text-indent: -9000px; width: 296px; } .msie #blog-title a { margin-bottom: -10px; position: relative; } #navigation { background-image: url(images/bg-nav.png); background-position: 0 0; background-repeat: no-repeat no-repeat; float: right; height: 22px; width: 474px; margin-top: 75px; } #navigation ul { } #navigation li { float: right; height: 22px; position: relative; list-style: none; } #navigation li a { font-family: Haettenschweiler; font-style: italic; letter-spacing: 1px; text-decoration: none; text-align: center; color: #FFFFFF; font-size: 0.95em; font-weight: bold; background-image: url(images/bg-nav-btn.png); background-repeat: no-repeat no-repeat; height: 22px; display: block; width: 69px; overflow: auto; } #navigation li a:hover { background-image: url(images/bg-nav-btn.png); background-position: 50% -22px; background-repeat: no-repeat; color: #000000; } #navigation li.item1 a { font-family: Haettenschweiler; font-style: italic; letter-spacing: 1px; text-decoration: none; text-align: center; color: #FFFFFF; font-size: 0.95em; font-weight: bold; background-image: url(images/bg-nav-btn1.png); background-repeat: no-repeat no-repeat; height: 22px; display: block; width: 69px; overflow: auto; } #navigation li.item1 a:hover { background-image: url(images/bg-nav-btn1.png); background-position: 50% -22px; background-repeat: no-repeat; color: #000000; } .clear { height: 0; font-size: 1px; margin: 0; padding: 0; line-height: 0; clear: both; } Example of problem If Image doesnt show below, view it he http://nadesign.pisigmachi.com/wp-content/uploads/2010/02/example.jpg URL HI Guys, I'm trying to create some CSS to contain an image gallery. A query runs which grabs all the images for a certain item/article. I then output the query as a loop, and it populates a div with images. It works pretty good, but if one image is bigger than the others, it throws off the alignment. How can I force each row of photos to be horizontally even? You can see the output results here http://details.at/photo_test.cfm <!--- Query ---> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> <style> #maindiv { padding:0 0 1em 2em; width:550px; float:left; } div.img { margin:3px; height:auto; width:auto; float:left; text-align:center; } </style> </head> <body> <DIV id="maindiv"> <H2>Photos</H2> <CFOUTPUT QUERY="photo_file_info"> <div class="img"> <a href="http://google.com" target=new> <img src="http://details.at/imagehost/classifieds/aircraft/139/s_#photo_file#"> </a> </div> </CFOUTPUT> </DIV> </body> </html> This is probably a dumb question, but I have a div, with a floated image inside. When the div doesn't have enough text inside to make it taller than the image, the image will stick out the bottom of the div. I've attached a couple of images to show what's happening. I want div to stretch around the image at all times, even if there's only one line of text next to it. Code: <html> <head> <style> body { width: 800px; /* change this value */ margin: 20px auto; } #container { border: 1px solid #f00; padding: 10px; } .floatright { float: right; margin: 10px; background-color: #aaf; } </style> </head> <body> <div id="container"> <h3>some latin text</h3> <p> <img class="floatright" src="some_image.jpg" width="100" height="150" alt="Image" /> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. </p> </div> </body> </html> My page has: 1) a left-sidebar which goes from the top-left corner and stretches down 2) a top-bar which goes from the edge of the left-sidebar and stretches all the way across to the right side of the page 3) a main content which covers the rest of the page I want to place an image in the center of the top-bar but so far it only is centered when the window is maximised...I want it to be centered no matter what size the window is. currently my css rules a Code: #topBar { position: absolute; height:15%; text-align: center; left:30%; margin:0px auto; } the xhtml source code for the topBar and image is: Code: <div id="topBar"> <p><img src="../logo1.jpg" alt="..." id="sirgLogo"/></p> </div> (the image id is just concerned with the size of the image at this time) any suggestions as to how to I can have the image centered within the <div>? some bright spark on Yahoo Answers failed to spot that I'm using xhtml (which tbf is only mentioned once) and told me to try: Code: <div id="topBar"> <p><center><img src="../logo1.jpg" alt="..." id="sirgLogo"/></center></p> </div> or Code: <div id="topBar" align="center"> <p><img src="../logo1.jpg" alt="..." id="sirgLogo"/></p> </div> Unless I'm mistaken, these are possibilities which will cause w3's validator to throw up an error. For the record I'm using XHTML 1.0 Transitional and I presume my doctype declaration is correct as it was automatically generated by dreamweaver when I first made the document! Supposing I have an image that is 200x200 pixels, and I have a div that is 100x100 pixels. I want to place the image inside the div AND have all 4 corners of the image visible. How do I do this? The idea is to fit the image inside the div without the image looking like it got "cut off" on any of its edges. I tried simply changing the CSS width and height but that did not achieve the desired effect. I'm hoping I won't need 4 divs, one for each corner? Hi guys, I've been struggling with this for some hours now and can't get this to work... I'm no css expert but this is driving me mad... The problem happens in firefox3, in IE7 it displays fine. My code is (copied from firebug): <div id="mydiv" style="margin: 0px; padding: 0px; position: absolute; z-index: 1; opacity: 0.9; left: 763px; top: 143px;"> <div style="border: 1px solid rgb(68, 68, 68); padding: 2px; font-size: 7pt; color: rgb(68, 68, 68); white-space: nowrap; background-color: rgb(255, 255, 255);" id="otherdiv"> Text goes here </div> <div style="position: relative; top: -1px;" id="yetanotherdiv"> <img src="images/bico_w.png" style="margin: 0px; padding: 0px; width: 14px; height: 7px;"/> </div> </div> This is a balloon like tooltip, with a div on top with the text, and a div on the bottom containing the handle image, all wrapped by another nice div. In Firefox, there's space on top and below the image that I can't figure out where it comes from (no space in IE7). If I put a "vertical-align:top" on the image, it sticks to the top div correctly (both IE and firefox), but then I can't get rid of space BELOW the image. Can you help me figure this out? |