簡體   English   中英

在新標簽頁中設置圖像的寬度

[英]Set the width of a image in a new tab

我想要的是文本中的鏈接到圖像。 當您單擊鏈接時,圖像應在新標簽上全屏打開。 到目前為止,圖片在新標簽頁上打開,但不是全屏顯示。 我的代碼如下所示:

<p>some text <a href="css/images/website.png" target="blank">website</a> and more text</p>

但是,如果我單擊鏈接,就我的情況而言,圖像看起來像是頁面的高度:

img[Attributes Style] {
width: 918px;
height: 979px;
}

我希望它像這樣

img[Attributes Style] {
width: 100%;
height: auto;
}

我試過了

<a href="css/images/website.png" width="100%">website</a>
<a href="css/images/website.png" style="width: 100%;"></a>

但兩者都不起作用。 你們有什么想法我該怎么做嗎?

這是我第一次在這里問問題,如果我做錯了什么,我想聽聽:)

您無法控制任何樣式屬性,因為新選項卡實際上不是html頁面,而僅是圖像本身。 另一方面,您可以制作一個html頁面,其唯一目的是顯示樣式圖像。 使您的鏈接類似<a href = "bigImg.html?src=css/images/website.png">website</a> ,在bigImg.html您可以使用javascript或php獲取所需圖像的src 。裝載。 bigImg.html的CSS中bigImg.html設置圖像樣式。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM