I have a <div>
and it has a image in background.
Now I want to put a list into that Div so how can I position that in
http://i.stack.imgur.com/VWmB2.png
you can See in above picture I have background and a list but I am not able to position it.
My Code
<div id="footer">
<div id="footer-content">
<div id="footer-list">
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#news">Blog</a></li>
<li><a href="#contact">About FF</a></li>
<li><a href="#about">FAQ</a></li>
<li><a href="#about">How To Play</a></li>
<li><a href="#about">Terms of Use</a></li>
<li><a href="#about">Privacy Policy</a></li>
</ul>
</div>
</div>
</div>
css--
#footer-list ul {
list-style-type: none;
margin: 0;
padding: 0;
margin-left: 500px;
margin-top: 100px;
}
#footer
{
background-image: url(/img/footer.png);
height: 140px;
width: 1820px;
background-repeat: no-repeat;
left:0px;
bottom: 0px;
}
The problem with my css is when I am giving the 'margin-top:100px' to ul it goes down but the background pic is also goes down.
So how can I position the list in div?
Yes, you can.
Using CSS, you can center text in a div in multiple ways. The most common way is to use the text-align property to center text horizontally. Another way is to use the line-height and vertical-align properties. The last way exclusively applies to flex items and requires the justify-content and align-items properties.
To make a right-aligned version of the list, only three changes need to occur. First, set the "UL" "text-align" to "right". Second, change the left "background-position" from "0" to "100%" - which makes the image align up with the right edge. And finally change "padding-left" to "padding-right".
You can add padding: 0 to the ul element to force it to stick to the left border of the parent nav element.
I think this is what you want. When u use <ul>
u can't use <div>
inside that. So checkout this
#footer-content ul {
list-style-type: none;
margin: 0;
padding: 0;
margin-left: 500px;
}
#footer-content ul li {
display: inline;
}
#footer
{
background-image: url('http://i.stack.imgur.com/VWmB2.png');
height: 140px;
width: 1820px;
background-size: 1820px 140px;
background-repeat: no-repeat;
left:0px;
bottom: 0px;
padding-top:50px;
}
<div id="footer">
<div id="footer-content">
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#news">Blog</a></li>
<li><a href="#contact">About FF</a></li>
<li><a href="#about">FAQ</a></li>
<li><a href="#about">How To Play</a></li>
<li><a href="#about">Terms of Use</a></li>
<li><a href="#about">Privacy Policy</a></li>
</ul>
</div>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With