『壹』 html中怎樣在背景圖片上同時添加圖片和文字
寫一個div,背景換成圖片,div內打上文字
<div style="width:200px; height:200px; background:url( 圖片路徑)">
<font>文字內容</font>
</div>
『貳』 如何在html圖片上加文字
你給一個div 添加背景圖,不影響在這個div裡面添加文字的,比如
<style>
.class{width: 200px;height: 200px;background: url("圖片路徑") no-repeat;}
</style>
注釋:background: url("圖片路徑") no-repeat;
repeat: 平鋪整個頁面,左右與上下
repeat-x: 在x軸上平鋪,左右
repeat-y: 在y軸上平鋪,上下
no-repeat: 圖片不重復
<div class="class">
<p>你的文字內容</p>
</div>
那麼在這個div的背景圖片就有了,你在裡面寫文字就可以了,如果你想給文字放到特定位置的話就需要定位了
『叄』 通過CSS+DIV怎麼將文字寫在圖片上方
HTML圖片和文字是並列顯示的。如下:
HTML
<div class="img-group"> <img src="img/snow.png">
<div class="img-tip">我是雪豹</div></div>
CSS
.img-group { position: relative; display: inline-block;
}
.img-tip { position: absolute; bottom: 0; background: #333; color: #fff; opacity: 0.6; display: none;
}
.img-group:hover .img-tip { display: block; width: 100%; text-align: center;
}
『肆』 在HTML中,怎麼在圖片上添加文字
一種方式:直接將這個圖用ps處理,還有一種html裡面有層級代碼,修改代碼將字這一層放在圖片上面
方法1: ps寫在圖片上
方法2: 給標簽加入圖片背景, 在標簽裡面寫字
方法3: 使用img載入圖片, 樣式設置為固定或絕對定位, 添加樣式
z-index:-1;
然後寫字
<span>dadasdasdas</span>
<imgsrc="XXXX"style="background:rgb(142,107,249);position:absolute;left:0;top:0;width:100%;height:100%;">
『伍』 html5怎麼在圖片上加文字
把圖片設置為背景圖片,然後加上文字就可以了
<style>
.img1{
width:200px;
height:200px;
background-image:url("img/1.jpg");
}
</style>
<div class="img1">圖片加文字</div>
『陸』 如何在圖片上方添加文字,求html代碼
用div+css就可以實現
圖片是一層,文字是一層
當兩層的位置是一樣的時候,就會出現圖片上有文字等信息了。
『柒』 html+css怎麼在圖片上添加文字
要在圖片上顯示文字,還要在放大縮小的時候文字不到處亂跑,這個就要用盒模型裡面的大盒子套小盒子的方法了。下面舉個小例子給你看看。
html大致樣子:
<body>
<div id="box1">
<div id="box2">
<img src="https://www..com/img/bd_logo1.png">
</div>
<div id="wenzi">這里是文字</div>
</div>
</body>
css文件:
#box1{
position:relative;
width:500px;
height:500px;
margin:0 auto;
}
#box2{
position:relative;
width:100%;
height:100%;
}
img{
position:relative;
clear:both;
width:100%;
height:100%;
}
#wenzi{
position:relative;
clear:both;
width:100%;
top:-50%;
text-align:center;
color:black;
font-size:2em;
}
效果圖片:
用這種方法有個好處,就是做響應布局的時候,或者用戶在瀏覽器上放大縮小的時候,網頁整體也跟著放大縮小,不會元素到處亂跑或者某個文字跑出來,這樣看起來整體感要強烈一點。
這種做法的不足之處:div盒子有點多,html代碼看起來比較臃腫,大盒子套著小盒子。做大頁面的時候一個htm看起來眼花繚亂的。但只要做好了注釋,還是分得清楚的啦,主要是這樣弄看起來頁面整齊一點。
『捌』 html中怎麼讓文字在圖片的上面
1、在div裡面書寫了一些文字,然後想要在放入一張圖片。
『玖』 HTML怎麼在圖片上加入文字
使用定位來寫的,首先一個大盒子裝著圖片,
然後一個盒子裝著頭像和文字,把裝著頭像和文字
的盒子根據裝著圖片的盒子進行定位就可以了,
像這樣的其實很簡單的,要多思考和分析
代碼,要注意圖片你要自己放圖片,和修改圖片路徑
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>圖片上放文字</title>
<style type="text/css">
html,body{
margin:0;
}
.auto-img{
display: block;
width:100%;
}
.box{
width:100%;
margin-top: 50px;
}
.box-cent{
width:50%;
margin:0 auto;
position: relative;
}
.texbox{
position: absolute;
width:50%;
line-height: 80px;
background-color: #0f0;
text-align: center;
top:50%;
left:50%;
transform: translate(-50%, -50%);
}
</style>
</head>
<body>
<div class="box">
<div class="box-cent">
<img class="auto-img" src="images/000.jpg"/>
<div class="texbox">我是用來裝頭像和文字的盒子</div>
</div>
</div>
</body>
</html>