html如何在标题后加图片?

html-css07

html如何在标题后加图片?,第1张

这个很容易实现,标题标签是块级元素,会独占一行,只要把display设置为inline-block就可以了。

<h1 style="display: inline-block">这是标题</h1>

<img src="image/1.png" width="90" height="90" alt="" srcset="">

<div style="position: relativelwidth:100pxheight:100px">

<div><img src="" /></div>

<div class="title"></div>

</div>

<style>

.title{ position: absolutebottom:0pxleft:0pxwidth:100pxheight:20pxbackgroup-color:#FFFFFF}}

.title:hover{ backgroup-color:#FF0000}

</style>

//半透明的效果可以通过png 的背景图片实现

<head>标签内的东西是不能显示在窗口中的,窗口正文中只能看到<body>标签里的内容。居中的话

需要外部标签居中显示,或者内部元素100%宽度,在居中

<html>

<head></head>

<body

style="

text-align:

center">

<h1

align="center">爱情</h1>

<p>演示</P>

<body

background="B.jpg">

</body>

</html