我需要在两侧制作带有图像的H1。
它必须在一条线上并且必须有响应。
像这样,但是====是一个小行的图像:
========= HEADER TEXT ============
目前的代码是:
<h1><img src="{{media url="wysiwyg/mintbar.png"}}" alt="" /> of WATCHES & MEN <img src="{{media url="wysiwyg/mintbar.png"}}" alt="" /></h1>
有什么想法吗?提前致谢!
答案 0 :(得分:1)
将图像和h1标题设置为内联块:http://jsfiddle.net/
HTML:
<img id="image-surround" src="{{media url="wysiwyg/mintbar.png"}}" alt="" />
<h1>of WATCHES & MEN</h1>
<img id="image-surround" src="{{media url="wysiwyg/mintbar.png"}}" alt="" />
CSS:
#image-surround { display: inline-block;
}
h1 { display: inline-block;
}
当然,您需要拥有一个容器才能使其正常响应。 http://jsfiddle.net/qn8dnvmg/4/
HTML:
<div class="container">
<div class="columns onethird">
<img id="image-surround" src="{{media url="wysiwyg/mintbar.png"}}" alt="" />
</div>
<div class="columns onethird">
<h1>of WATCHES & MEN</h1>
</div>
<div class="columns onethird">
<img id="image-surround" src="{{media url="wysiwyg/mintbar.png"}}" alt="" />
</div>
</div>
CSS:
.container { position: relative;
margin: 0 auto;
padding: 0;
width: 960px;
padding-left: 10px;
padding-right: 10px;
}
.container .column, .container .columns { float: left;
display: inline;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding-left: 2px;
padding-right: 2px;
}
.row { margin-bottom: 20px;
}
.clear { clear: both;
height: 1px;
width: 100%;
}
.container .onehalf.columns { width: 50%; }
.container .full.columns { width: 100%; }
.container .onethird.columns { width: 33.33%; }
.container .twothirds.columns { width: 66.66%; }
.container .onequarter.columns { width: 25%; }
.container .twoquarters.columns { width: 50%; }
.container .threequarters.columns { width: 75%; }
.container .onefifth.columns { width: 20%; }
.container .twofifths.columns { width: 40%; }
.container .threefifths.columns { width: 60%; }
.container .fourfifths.columns { width: 80%; }
.container .oneeight.columns { width: 12.5%; }
.container .twoeights.columns { width: 25%; }
.container .threeeights.columns { width: 37.5%; }
.container .foureights.columns { width: 50%; }
.container .fiveeights.columns { width: 62.5%; }
.container .sixeights.columns { width: 75%; }
.container .seventeights.columns { width: 87.5%; }
.container .onetenth.columns { width: 10%; }
.container .twotenths.columns { width: 20%; }
.container .threetenths.columns { width: 30%; }
.container .fourtenths.columns { width: 40%; }
.container .fivetenths.columns { width: 50%; }
.container .sixtenths.columns { width: 60%; }
.container .seventhtenths.columns { width: 70%; }
.container .eighttenths.columns { width: 80%; }
.container .ninetenths.columns { width: 90%; }
然后你的媒体查询等。