10 weber Posted April 15, 2010 Share Posted April 15, 2010 It's very easy to set the size of a normal image, but how is it done if the image is in the background? Link to comment Share on other sites More sharing options...
ShadowMage Posted April 15, 2010 Share Posted April 15, 2010 If the image is set in the CSS background attribute I don't think it's possible.However, you could use a div (or even an img) and use that tag as the background for the page. Set the image as the background of the div. Set the size of the div and use absolute positioning to remove it from the flow of the page. You will probably also want to set the z-index low so that it goes behind your content and use another div as your content div with the z-index set a little higher. Link to comment Share on other sites More sharing options...
thescientist Posted April 15, 2010 Share Posted April 15, 2010 i guess it depends on what you want to do. I would start here and see if it helps.http://www.w3schools.com/css/css_background.asp Link to comment Share on other sites More sharing options...
10 weber Posted April 15, 2010 Author Share Posted April 15, 2010 i guess it depends on what you want to do. I would start here and see if it helps.http://www.w3schools.com/css/css_background.asp I have already tried to find the answer there, but it's not mentioned.As for the usage of an img tag - it's possible, but it's very complicated (a lot of things to reprogram). If no one find another way to do that, I'll start. Link to comment Share on other sites More sharing options...
ShadowMage Posted April 15, 2010 Share Posted April 15, 2010 As for the usage of an img tag - it's possible, but it's very complicated (a lot of things to reprogram). If no one find another way to do that, I'll start.No really its not. You create an img tag with some CSS declarations. That's it.<body><img id='bg_image' src='image.jpg' alt='' /><div id='contentDiv'>...content</div></body> #bg_image {position: absolute;top: 5%;left: 5%;z-index: 0;height: 500px;width: 600px;}#contentDiv {z-index: 5;} Link to comment Share on other sites More sharing options...
10 weber Posted April 15, 2010 Author Share Posted April 15, 2010 No really its not. You create an img tag with some CSS declarations. That's it.<body><img id='bg_image' src='image.jpg' alt='' /><div id='contentDiv'>...content</div></body> #bg_image {position: absolute;top: 5%;left: 5%;z-index: 0;height: 500px;width: 600px;}#contentDiv {z-index: 5;} That's usually true, except that in this case I would have to change the scripts, that were written especially for a singular tag. The new script would have to be 70 to 100 rows longer, so it's not too terrible, but I prefer to wait a little. Link to comment Share on other sites More sharing options...
ShadowMage Posted April 15, 2010 Share Posted April 15, 2010 That's usually true, except that in this case I would have to change the scripts, that were written especially for a singular tag. The new script would have to be 70 to 100 rows longer, so it's not too terrible, but I prefer to wait a little.What kind of script? What does the script do exactly? Link to comment Share on other sites More sharing options...
10 weber Posted April 19, 2010 Author Share Posted April 19, 2010 What kind of script? What does the script do exactly?The background-image's size is gradually enlarged onMouseOver and reduced onMouseOut. The opacity is changed onClick and the text disappears when a button is clicked. Link to comment Share on other sites More sharing options...
ShadowMage Posted April 19, 2010 Share Posted April 19, 2010 Perhaps there's more to it than I think there is, but it doesn't sound like it would really take all that much to change that script. It's already targeting a single element you said, correct? Then couldn't you just change the target of the script (the element it's working on)? You'd likely still have to make a few tweaks here and there but I don't think it will be as big a chore as you think. Link to comment Share on other sites More sharing options...
10 weber Posted April 19, 2010 Author Share Posted April 19, 2010 Perhaps there's more to it than I think there is, but it doesn't sound like it would really take all that much to change that script. It's already targeting a single element you said, correct? Then couldn't you just change the target of the script (the element it's working on)? You'd likely still have to make a few tweaks here and there but I don't think it will be as big a chore as you think.It does seems a little less complicated than I thought. The main problem was dealing with the opacity support in some browsers, but I guess it's not so bad. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.