html - DIV background disappearing when child image is positioned absolute -


i'm trying make joomla template , have strange problem html , css code. have footer text joomla module , img. when try bring image right side of footer seting position absolute , right 0 background of footer disappears.

my html code:

<footer>     <p>some text</p>     <p><jdoc:include type="modules" name="footer" /></p>     <img src="<?php echo $templatedir;?>/images/footerbgr.png"/> </footer> 

my css code:

footer {     width: 75%;     position: relative;     margin: 0px 10% 0px 10%;     background: #292929;     border-radius: 25px; }  footer p {     float: left;     color: #fff;     margin: 3px 0px 0px 10px; }  footer img {     position: absolute;     right: 0px; } 

when remove "position: absolute;" background shown image not want it.

you need give height footer

footer {     width: 75%;     position: relative;     margin: 0px 10% 0px 10%;     background: #292929;     border-radius: 25px;     height:100px; } 

change footer height per image height.

jsfiddle file

you can way also

give height: 100% , overflow: hidden footer , remove thr absolute position image , give float: right

footer {     width: 75%;     position: relative;     margin: 0px 10% 0px 10%;     background: #292929;     border-radius: 25px;     height:100%;     overflow:hidden; }  footer img {     float:right; } 

jsfiddle file


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -