CSS或屬性需要什麼組合?在所有瀏覽器中設置統一的<input type =「file」>寬度
37
A
回答
31
22
有什麼錯
<input type="file" size="50" .... />
? 將目光相同,除了在Mac上我猜野生動物園(在Mac上,所有上傳控件看起來不一樣,對所有的瀏覽器)
7
除了怪異模式教程,這裏是另一個很好的資源: http://www.shauninman.com/archive/2007/09/10/styling_file_inputs_with_css_and_the_dom
如果你隱藏實際控件,請記住將控件的不透明度設置爲零非常重要,而不是實際使用visibility: hidden
。這樣做會實際隱藏元素,禁用點擊操作。另外,如果你用一個圖形按鈕來掩蓋控件,請注意,在某些瀏覽器(Firefox和IE,我相信)中,當它是一個遊標時,你將無法將遊標類型改爲手覆蓋文件控件的文本輸入部分(它始終默認爲輸入或常規非鏈接指針)。是的,我試過使用cursor: pointer
(和cursor: hand
)。個人而言,我一直在爲自定義上傳框付出艱辛的努力,而且沒有銀彈讓他們的外觀或定製完美無缺。 (特別是關於遊標的行爲,因爲我認爲這是一個UI交易斷路器)。在一天結束時,我認爲接受不同的瀏覽器會以不同的方式呈現控件更容易,而這正是它的原因。
相關問題
- 1. 有沒有辦法設置<input type ='file'/>在Firefox中顯示的寬度?
- 2. <input type =「file」/>
- 3. 文件瀏覽器控件替換<input type =「file」>
- 4. 定製<input type =「file」>?
- 5. 清除<input type = file>
- 6. <input type =「file」> EMPTY
- 7. <input type =「file」/>的幫助器
- 8. 如何在<input type =「text」>標籤內放置<input type =「file」>?
- 9. HTML <input type =「text」... as <input type =「file」
- 10. 是否可以使用CSS來設置<input type =「file」>?
- 11. 不使用<input type =「file」/>
- 12. 覆蓋<input type =「file」>值屬性
- 13. 回顧從<input type =「file」>
- 14. 當<input type =「file」>形式爲
- 15. 通過打開<input type =「file」>
- 16. 問題與<input type =「file」>
- 17. 我可以使用<input type =「text」>來模擬<input type =「file」>嗎?
- 18. 如何讓HTML5 <input type = month>適用於所有瀏覽器?
- 19. <input type ='text'/>和<textarea>寬度
- 20. 如何隱藏<input type ='file'>中的文件位置?
- 21. 將值設置爲<input type =「number」/>
- 22. input [type =「file」],不同操作系統和瀏覽器中的不同MIME類型
- 23. Javascript .innerHTML重置我的<input type =「file」>
- 24. HTML 5鏈接/屏蔽<input type ='file'>至<a>
- 25. 是否有可能在一個表單中有兩個「<input type = file>」?
- 26. 如何在iPhone上的Safari中使用<input type ='file'>?
- 27. <Input type =「file」>在我的WebView中不工作
- 28. <input type ='button'/>和<input type ='submit'/>之間的區別
- 29. <input type =「file」>帶有扭曲的默認值
- 30. input [type = file] validation
所以沒有辦法使用本地控制本身來實現這一點? – Larsenal 2008-11-06 18:25:40
我已經更新了答案。請參閱:http://www.quirksmode.org/dom/inputfile.html – 2008-11-06 19:02:49