Author | Message | Time |
---|---|---|
Spht | I have a picture. On top of the picture I have a table which describes the picture. But the table has nothing to do with my question. Get the picture? It's set up like this: [code]<div style="background-image: url(myphoto);" class="photo"> <table class="description"> <tr> <td>mydescription</td> </tr> </table> </div>[/code] And in my styles.css: [code]div.photo { background-repeat: no-repeat; background-attachment: scroll; height: 420px; width: 560px; border: 1px solid black; }[/code] This displays my 560x420 photo with a 1 pixel black border. Instead of the border being put on the div, I want the border put on the background image, so I can make the div larger than the image, and the border will be around the image instead of the div. I don't want to manually draw a border on the image. Is there a 'background-border' type of thing? | September 25, 2004, 6:47 AM |
Spht | Second, I want my description table to start at the bottom of the photo div, instead of the top. Is there a 'table-position: bottom' type of thing? | September 25, 2004, 6:49 AM |
Magickian | Doesn't look like there's one to me, you can specify where the div border points begin and end (border-top, border-right, etc), but then you would have to make all your images the same height/width. | September 25, 2004, 7:55 AM |
peofeoknight | Don't use a background image then. Add the image in with the img tag, but then use style="z-index:-1;" so the contents around it, like the table cell, will slide over it. It will act like a background image but it will let you position it better and give you more control over the style. http://www.w3schools.com/css/tryit.asp?filename=trycss_zindex2 There is a css equiv to valign: vertical-align: bottom; Try that. Personally I would ditch the tables and use divs but put them all in a class so the same set of properties can apply to them all. | September 25, 2004, 3:38 PM |
Spht | [quote author=Magickian link=board=22;threadid=8829;start=0#msg81916 date=1096098942] Doesn't look like there's one to me, you can specify where the div border points begin and end (border-top, border-right, etc), but then you would have to make all your images the same height/width. [/quote] All my photos have the same dimentions. I'm pretty sure you can only specify the width, style, and color of the border with those. [quote author=peofeoknight link=board=22;threadid=8829;start=0#msg81954 date=1096126704] Don't use a background image then. Add the image in with the img tag, but then use style="z-index:-1;" so the contents around it, like the table cell, will slide over it. It will act like a background image but it will let you position it better and give you more control over the style. http://www.w3schools.com/css/tryit.asp?filename=trycss_zindex2 There is a css equiv to valign: vertical-align: bottom; Try that. Personally I would ditch the tables and use divs but put them all in a class so the same set of properties can apply to them all. [/quote] I'll probably end up doing that. Edit - vertical-align: bottom doesn't put my description table at the bottom of my "photo" div. Switched to a div for description, and that doesn't push it to the bottom either. | September 25, 2004, 3:57 PM |
peofeoknight | Well what you can do to move the div to the bottom is just do some positioning action. If the image is using the img tag you can just say margin-top:5px; postion:relative; or something like that, and the div should go right under that image. This is more like theorizing, I have to play with css to get it to do what I want :P. Css is a lot of trial and error, but I still love it. | September 25, 2004, 4:06 PM |
Spht | It turns out the z-index: -1 isn't what I need. My page is on top of one big div, so the image gets put behind that div when using z-index: -1. | September 25, 2004, 4:11 PM |
peofeoknight | Well z-index will put higher elements above lower elelemtns. So just make sure the element you want to go over the image is higher then the image. The image could be z-index:4; and the lement you want over it 5 and it will put the five over the 4. | September 25, 2004, 4:13 PM |
kamakazie | Why not something like this? CSS: [code] .picture { border: 1px solid black; } .picture_description { position: relative; top: -100; left: 20; } [/code] XHTML: [code] <div> <img src="picture.jpg" class="picture" /> <div class="picture_description"> My description </div> </div> [/code] That puts text over the photo, just remove the picture_description css stuff and it will be at the bottom of the photo. | September 25, 2004, 10:15 PM |
Spht | [quote author=dxoigmn link=board=22;threadid=8829;start=0#msg82028 date=1096150532]-[/quote] Oh yeah! You can use negatives! All I needed to do was set my margin-top below zero to move the description div up! [img]http://www.valhallalegends.com/spht/maycmath.gif[/img] Thanks for the help all. | September 25, 2004, 11:29 PM |
peofeoknight | Ugh, I wish I knew thats what you were trying to do before lol. I thought this was going to be a lot of images arranged with text over them for some reason. Nice cat btw :) | September 26, 2004, 7:28 AM |