问题
I want to set the input tag in my HTML document to rtl and their title attributes to ltr. Is it possible?
回答1:
I do not believe the direction in which the text of the tooltip is displayed in (which is what I'm guessing what you meant by their title
attribute) can be dictated through CSS.
The HTML specification simply states that browsers should display it in whatever fashion they wish, so the direction of the text in the tooltip would most likely be dependent on the user's own settings, probably at the Operating System level.
However, you can use JavaScript to create your own, non-native tooltips, which can then be styled through CSS.
回答2:
I can't think of a css selector that would allow you to access the title
attribute, so no; I really don't think this is possible. I'll also note that having two different text-flow directions in the same document, and, potentially, differing between one element and its tooltip would likely be confusing.
This would be possible with JavaScript, though.
来源:https://stackoverflow.com/questions/4692914/setting-a-different-direction-for-the-input-tag-and-its-title-attribute