我在这样硬编码的文章中有图片:
<img border="0" align="right" src="http://www.domain/picture.jpg" width="300" height="450">
我无法更改这行代码,但想为该图像添加 CSS(仅右对齐),有什么方法可以在不更改其他对齐方式的情况下完成吗? (如果我将 CSS 添加到 img,那么它也会改变居中对齐的图片等)
我希望有人有时间回答:)
谢谢!
最佳答案
你可以使用属性选择器
img[align="right"] {
// your css
}
The CSS attribute selector matches elements based on the presence or value of a given attribute.
关于html - 连接硬编码对齐 HTML 与 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50306533/