microdata without span tag

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 21:15:47

问题


I have a site where the designer applied CSS to the base <span> tag which makes the tag effectively useless for microdata markup unless I want all my text to be blue, bold, and 125% bigger than normal. Are there alternative tags that I can use? I understand that I can use <meta> but I actually want the content to appear and it seems overkill to have to write it twice.


回答1:


You can use every HTML5 element for Microdata. But note that some elements have special rules for determining the value, and some elements come with additional requirements if used with Microdata.

If your question is if there is another inline HTML5 element that has no meaning (= span): no, there isn’t.

If your question is how to use span without the applied CSS: add a class to "your" span elements and overwrite any applied CSS with CSS’s class selector:

<span class="never-style-span-directly" itemprop="example">…</span>

CSS:

span {color:blue;}
.never-style-span-directly {color:inherit;}



回答2:


Why not do a site-wide find and replace for existing tags and update replace with something like <span class="blueLargerTextWhyOhWhy"> (class name optional) and update the stylesheet to target that class rather than all spans.

Once done and tested you will be free to use generic tags as needed.

Also educate that designer if you can :)



来源:https://stackoverflow.com/questions/20808208/microdata-without-span-tag

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!