在圖片里添加文字)
1、【background】引用背景圖片,
兩種引用:
css:{background:URL(img.jpg)}
html: <a src="img.jpg"></a>
2、建立需要尺寸的div塊, 在新建一個div塊,,利用原始的覆蓋現有的。
3、塊需被包含在圖片【div】塊里,再包含文字【div】塊。
4、注需要控制方向【 float】。
<!doctype html> <html> <head> <meta charset="utf-8"> <title>圖片添加文字</title> <style type="text/css"> .div{width:800px; height:450px;} .img{width:800px; height:450px; background:url(../img.jpg);} .imgfont{ width:650px; height:400px; float:right;} .font{ width:650px; height:50px; float:right;} .fontt{width:180px;height:50px; text-align:center; color:#FFF; font-size:16px;} </style> </head> <body> <div class="img"> <div class="imgfont"> </div> <div class="font"> <div class="fontt"> <p>這是一張圖片</p> </div> </div> </div> </body> </html>