我有一个css和HTML代码,标题中有两个部分:一个用于Logo,另一个用于导航。我想把它们放在同一行,这样可以节省一些空间并且看起来更好。有人可以指导我如何做到这一点吗?
答案 0 :(得分:1)
Float:left;
logo width:100%;
float:left;
和#nav
overflow:hidden;
#nav
clear:left;
#content
醇>
直播示例: http://jsbin.com/eyozo
答案 1 :(得分:0)
最简单的方法就是在background-image
元素上使用h1
:
h1 {
padding-left: 200px; /* width of the image plus a 'buffer' between image and text */
height: 150px; /* vertical height of the image */
line-height: 150px; /* to vertically-align the image with the text */
background: #fff url(path/to/image.png) 0 0 no-repeat;
}