我試圖獲得在Web2Py中使用對{{=IMG()}}
的調用設置CSS <style>
的基本語法。我已經試過如下:在IMG中的Web2Py CSS樣式()
<style>img.bottom { vertical-align: text-bottom; } </style>
<body>
{{=IMG(_src=URL('static',args='images/golem.jpg', _style='img.bottom'),_alt="golem"}}
</body>
失敗
<body>
{{=IMG(_src=URL('static',args='images/golem.jpg', styles={'CODE':'vertical-align: text-bottom;'}), _alt="golem")}}
<body>
也未能
<style>img.bottom { vertical-align: text-bottom; } </style>
<body>
{{=IMG(_src=URL('static',args='images/golem.jpg'), _style='bottom',_alt="golem"}}
</body>
也未能
<style>img.bottom { vertical-align: text-bottom; } </style>
<body>
{{=IMG(_src=URL('static',args='images/golem.jpg'), _class='bottom',_alt="golem"}}
</body>
也未能
我覺得我一定要接近,但我無法在文檔中找到樣式爲IMG()
的論據,我似乎無法覆蓋存在的(非)樣式。
Just in case anyone wants to see the Web2Py docs where the answer is not
你是(像往常一樣)正確。我知道我試過這個。我一定有一個錯字。 – 2014-08-30 20:45:35
Hi.Is有一個選項可以從多個圖像中隨機選擇圖像嗎? – wakamdr 2018-01-10 10:29:08
如果你在詢問'IMG()'helper是否包含這樣一個選項,否(對於簡單的HTML幫助程序來說似乎很罕見),但它只是Python代碼,所以編寫自己的代碼應該很簡單選擇一個隨機圖像。 – Anthony 2018-01-10 15:41:45