I'm designing a liquid layout mobile website. As the header I have a centered div that that has "text-align: right;", which contains my logo. Then an other div is set to "float: left;" and this one contains my site title.
I wish to vertically align the text to the logo, while the text remains aligned to the left, and the logo stays aligned to the right, how do I accomplish this?
Stripped code for the relevant bit:
<div id="wrapper">
<div id="title">
<h3>My title</h3>
</div><!--end title-->
<div id="logo">
<img src="images/logo.jpg" alt="Logo" class="logo" />
</div><!--end logo-->
CSS:
html, body{
margin: 0;
padding: 0;
height: 100%;
font-family: Arial, Helvetica, sans-serif;
}
img.logo{
width: 96px;
height: 41px;
}
#wrapper{
min-height: 100%;
}
#title{
float: left;
padding: 0.5em 0 0.5em 10%;
}
#logo{
width: 90%;
margin: 0 auto;
text-align: right;
padding: 0.5em;
}
Many thanks in advance!
You can use text-align: justify
like so:
div { text-align: justify; line-height: 100px; height: 100px; background: gold; } img, span { display: inline-block; vertical-align: middle; } div:after { content: ''; display: inline-block; width: 100%; }
<div> <span>test</span> <img src=http://placehold.it/100x50> </div>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.