Jsfiddle:https://jsfiddle.net/gu7b3fbs/
我希望将图像放在中间位置,并将“转到主网站”放在最高位置,高于图片,同时保持响应性。但是,在重新调整窗口大小时,“转到主网站”应该会在图像上方传递。有什么帮助吗?
HTML:
<div class="header">
<div class="wrap">
<div class="logo">
<a href="index.html"><img src="images/logo.png" alt=""/></a>
</div>
<div class="nav">
<ul>
<li class="a"><a href="">Go to the main website</a> </li>
</ul>
<div class="clear"> </div>
</div>
<div class="clear"> </div>
</div>
</div>
CSS:
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,dl,dt,dd,ol,nav ul,nav li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline;}
article, aside, details, figcaption, figure,footer, header, hgroup, menu, nav, section {display: block;}
ol,ul{list-style:none;margin:0;padding:0;}
blockquote,q{quotes:none;}
blockquote:before,blockquote:after,q:before,q:after{content:'';content:none;}
table{border-collapse:collapse;border-spacing:0;}
/* start editing from here */
a{text-decoration:none;}
.txt-rt{text-align:right;}/* text align right */
.txt-lt{text-align:left;}/* text align left */
.txt-center{text-align:center;}/* text align center */
.float-rt{float:right;}/* float right */
.float-lt{float:left;}/* float left */
.clear{clear:both;}/* clear float */
.pos-relative{position:relative;}/* Position Relative */
.pos-absolute{position:absolute;}/* Position Absolute */
.vertical-base{ vertical-align:baseline;}/* vertical align baseline */
.vertical-top{ vertical-align:top;}/* vertical align top */
.underline{ padding-bottom:5px; border-bottom: 1px solid #eee; margin:0 0 20px 0;}/* Add 5px bottom padding and a underline */
nav.vertical ul li{ display:block;}/* vertical menu */
nav.horizontal ul li{ display: inline-block;}/* horizontal menu */
img{max-width:100%;}
/*end reset*/
body {
background: url('../images/bg.jpg') repeat;
}
.wrap {
width: 80%;
margin: 0px auto;
}
.header {
background: white;
border-bottom: 13px solid white;
border-top: 13px solid white;
margin-top: 0em;
}
.logo
{
float: left;
padding-top: 21px;
}
.nav
{
float: right;
width: 47%;
}
.nav ul li
{
float:left;
border-right: 1px solid rgba(238, 238, 238, 0.65);
}
.nav ul li.a
{
border-left: 1px solid rgba(238, 238, 238, 0.65);
}
.nav ul li a
{
font-size: 1.0em;
color:#5F6A72;
font-family: 'Verdana', sans-serif;
display: block;
-webkit-transition: 0.5s linear;
-moz-transition: 0.5s linear;
-ms-transition: 0.5s linear;
-o-transition: 0.5s linear;
transition: 0.5s linear;
padding: 3px 30px;
}
.nav ul li a:hover
{
}
这是职位:
答案 0 :(得分:0)
这是所需的输出吗?
.logo{
padding-top: 21px;
margin: 0px auto;
//float: left; //remove this
}