2017-07-21 22 views
0

我是網頁設計新手。我想爲我的網站建立一個評論系統,我在文本區域有一些問題。如何用textarea中的相同動作替換圖像(圖標)而不是輸入類型文件?如何用文本區域中的相同動作替換輸入類型文件中的圖像(圖標)?

我該如何執行相同的操作?

HTML

<div class="upload"> 
    <div class="image-upload"> 

    <textarea name="" id="txt" cols="20" rows="5"></textarea> 
    <label for="file-input"> 
    <img src=""> 
    </label> 

    <input id="file-input" type="file"/> 
</div> 
</div > 

CSS

.upload{ 
display:inline-block; 
position:relative; 
} 
input{ 
position:absolute; 
bottom:10px; 
right:2px; 
} 
textarea{ 
display:block; 
width:500px; 
} 
.image-upload > input 
{ 
display: none; 
} 
.image-upload img 
{ 
width: 40px; 
cursor: pointer; 
} 

我試過很多次,但沒有工作。

+0

你的問題還不清楚。你到底想做什麼? –

+0

@yogendarji如何在textarea中放置一個圖標 –

回答

0

要在文本區域添加一個圖標,插入的圖標<img>標籤<textarea>後,再添加以下的CSS:

.icon-class { 
    position: absolute; 
    top: 0; 
    left: 0; 
}