liamoco Posted December 8, 2010 Share Posted December 8, 2010 I want to position a background color but not a background image, can this be done? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/220978-background-position/ Share on other sites More sharing options...
requinix Posted December 8, 2010 Share Posted December 8, 2010 Not really. Position how? Quote Link to comment https://forums.phpfreaks.com/topic/220978-background-position/#findComment-1144237 Share on other sites More sharing options...
liamoco Posted December 8, 2010 Author Share Posted December 8, 2010 Lets say I have a div element 50px by 50px, is it possible to set the bottom half of this element to have a red background color, without an image or child element. Quote Link to comment https://forums.phpfreaks.com/topic/220978-background-position/#findComment-1144243 Share on other sites More sharing options...
ohdang888 Posted December 8, 2010 Share Posted December 8, 2010 Lets say I have a div element 50px by 50px, is it possible to set the bottom half of this element to have a red background color, without an image or child element. no, to my understanding, you would either have to use a child element or image Quote Link to comment https://forums.phpfreaks.com/topic/220978-background-position/#findComment-1144252 Share on other sites More sharing options...
requinix Posted December 8, 2010 Share Posted December 8, 2010 ...a background image being the better option, of course (since the div has a fixed size). Quote Link to comment https://forums.phpfreaks.com/topic/220978-background-position/#findComment-1144263 Share on other sites More sharing options...
haku Posted December 8, 2010 Share Posted December 8, 2010 Can't be done. An image isn't really the best idea, as a little CSS is much smaller to load than an image. You can do it like this I believe: <div id="container"> <div id="underlay"></div> <p>Some text some text some text some text</p> </div> CSS: #container { position:relative; } #underlay { position:absolute; height:50%; bottom:0; left:0; } You may have to set the z-index on the #underlay as well. Quote Link to comment https://forums.phpfreaks.com/topic/220978-background-position/#findComment-1144436 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.