我可以將 CSS 樣式應用於元素名稱嗎? - Can I apply a CSS style to an element name?

問題:

I'm currently working on a project where I have no control over the HTML that I am applying CSS styles to.我目前正在開發一個項目,在該項目中我無法控制應用 CSS 樣式的 HTML。 And the HTML is not very well labelled, in the sense that there are not enough id and class declarations to differentiate between elements.並且 HTML 沒有很好地標記,因爲沒有足夠的 id 和 class 聲明來區分元素。

So, I'm looking for ways I can apply styles to objects that don't have an id or class attribute.因此,我正在尋找可以將樣式應用於沒有 id 或 class 屬性的對象的方法。

Sometimes, form items have a "name" or "value" attribute:有時,表單項具有“名稱”或“值”屬性:

<input type="submit" value="Go" name="goButton">

Is there a way I can apply a style based on name="goButton"?有沒有辦法可以應用基於 name="goButton" 的樣式? What about "value"? “價值”呢?

It's the kind of thing that's hard to find out because a Google search will find all sorts of instances in which broad terms like "name" and "value" will appear in web pages.這是一種很難找到的東西,因爲 Google 搜索會找到各種情況,其中“名稱”和“價值”等寬泛的術語會出現在網頁中。

I'm kind of suspecting the answer is no... but perhaps someone has a clever hack?我有點懷疑答案是否定的......但也許有人有一個聰明的黑客?

Any advice would be greatly appreciated.任何建議將不勝感激。


解決方案:

參考一: https://en.stackoom.com/question/Mwfu
參考二: https://stackoom.com/question/Mwfu
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章