Đến rất muộn bên này, nhưng bạn có thể sử dụng bộ chọn thuộc tính.
Trong trường hợp của bạn, để nhắm mục tiêu các yếu tố class='a.b'
, bạn có thể sử dụng:
[class~="a.b"] {...}
// or
span[class~="a.b"] {...}
Thêm vào đó, đây là danh sách đầy đủ của bộ chọn thuộc tính.
Attribute Selector hiện
// Selects an element if the given attribute is present
// HTML
<a target="_blank">...</a>
// CSS
a[target] {...}
Thuộc tính Equals Selector
// Selects an element if the given attribute value
// exactly matches the value stated
// HTML
<a href="http://google.com/">...</a>
// CSS
a[href="http://google.com/"] {...}
Thuộc tính Chưa Selector
// Selects an element if the given attribute value
// contains at least once instance of the value stated
// HTML
<a href="/login.php">...</a>
// CSS
a[href*="login"] {...}
Thuộc tính Begins With Selector
// Selects an element if the given attribute value
// begins with the value stated
// HTML
<a href="https://chase.com/">...</a>
// CSS
a[href^="https://"] {...}
Thuộc tính Ends With Selector
// Selects an element if the given attribute value
// ends with the value stated
// HTML
<a href="/docs/menu.pdf">...</a>
// CSS
a[href$=".pdf"] {...}
Attribute Spaced Selector
// Selects an element if the given attribute value
// is whitespace-separated with one word being exactly as stated
// HTML
<a href="#" rel="tag nofollow">...</a>
// CSS
a[rel~="tag"] {...}
Attribute hyphenated Sele ctor
// Selects an element if the given attribute value is
// hyphen-separated and begins with the word stated
// HTML
<a href="#" lang="en-US">...</a>
// CSS
a[lang|="en"] {...}
Source: learn.shayhowe.com
gì hệ thống điên sẽ tạo ra một classname như vậy? – SLaks
Phân chia một phần, nhưng có thể trả lời câu hỏi: http://stackoverflow.com/questions/448981/what-characters-pe-valid-in-css-class-names –
hệ thống điên: tên lớp là các khóa từ tệp thuộc tính.Các tệp thuộc tính khác nhau cho các ngôn ngữ khác nhau cho phép định dạng động dựa trên nội dung độc lập về ngôn ngữ nhưng ngữ nghĩa. – mut1na