Reputation: 359
I want to align some text under an image but the icon is on the left. Whenever I put a padding-left or right or margin to it it centers for one block but not for both. This is really annoying. You can see it on this screenshot: http://cl.ly/1G0D191t1G3V1v0a0K2q
HTML:
<html xmlns="http://www.w3.org/1999/html">
<head>
<link href="<?php echo base_url('css/style.css');?>" rel="stylesheet" type="text/css" />
<title>Admin :: Home</title>
</head>
<body>
<div id="wrapper">
<div class="admin-form">
<div class="header">
<h1>Admin Home</h1>
</div>
<div class="content dashboard clearfix">
<ul>
<li><a href='<?php echo base_url('admin/DiveLocations');?>'><img src='<?php echo base_url('images/icons/duikplaats.png');?>'/>Duiklocaties</a></li>
<li><a href='<?php echo base_url('admin/DiveEvents');?>'><img src='<?php echo base_url('images/icons/scubadiving.png');?>'/>Duiken</a></li>
<li><a href='<?php echo base_url('admin/Users');?>'><img src='<?php echo base_url('images/icons/users.png');?>'/>Gebruikers</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>
CSS:
.dashboard img {
display: block;
margin-left:25px;
}
.dashboard ul li {
list-style-type: none;
float: left;
padding: 0 10px 0 0;
}
Upvotes: 0
Views: 886
Reputation: 9041
In this case i would put the text within a <span>
and the clear it:
.dashboard span {
clear:both;
display:block;
}
I've done a fiddle for you - http://jsfiddle.net/JMEMc/
Upvotes: 1