admin管理员组文章数量:1122826
I am wondering how do you do when you have to create a shortcode with multiple hover or complex options ( gradient, boxshadow etc, thing that can't be inline ). How do you generate the css.
I don't want to generate a <style></style>
block because for a simple shortcode used 10 times in the page would generate 10 blocks.
All the shortcode are set from the page, by the user, so are created when the_content() is called.
I want to give the user the possibility to edit and custom the shortcode for exmample let the user choose what border-radius to use when button is hovered etc.
Looking for an option that would validate as html5 and in WC3.
Adding an ID to each shortcode and generate custom css is what I am looking to do but I can't find a way to do this properly ( without creating <style></style>
block everywhere )
Any advice and examples are welcome.
Thanks in advance!
I am wondering how do you do when you have to create a shortcode with multiple hover or complex options ( gradient, boxshadow etc, thing that can't be inline ). How do you generate the css.
I don't want to generate a <style></style>
block because for a simple shortcode used 10 times in the page would generate 10 blocks.
All the shortcode are set from the page, by the user, so are created when the_content() is called.
I want to give the user the possibility to edit and custom the shortcode for exmample let the user choose what border-radius to use when button is hovered etc.
Looking for an option that would validate as html5 and in WC3.
Adding an ID to each shortcode and generate custom css is what I am looking to do but I can't find a way to do this properly ( without creating <style></style>
block everywhere )
Any advice and examples are welcome.
Thanks in advance!
Share Improve this question edited May 28, 2016 at 5:42 Lucas Selsek asked May 24, 2016 at 8:21 Lucas SelsekLucas Selsek 516 bronze badges 5 |1 Answer
Reset to default 0Gradient and boxshadow are fine to put inline. Your trouble will be with the hover states. Luckily there is a trick. You can put the hover styles in an outer element and force inherit on hover. Like this:
<div class="myshortcode">
<a style="color:blue;"><span style="color:red;">Content</span></a>
</div>
In your style.css you add this generic line with a transition effect as bonus:
.myshortcode a span {transition:color 1s;}
.myshortcode a:hover span {color:inherit !important;}
本文标签: phpHow create a Shortcode with hover and complex options
版权声明:本文标题:php - How create a Shortcode with hover and complex options 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736286098a1927598.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
<style>
blocks don't validate as html5 (but work just fine) – cjbj Commented May 24, 2016 at 10:40<style>
blocks will not validate which, that's why I want to avoid this and find an other way. – Lucas Selsek Commented May 24, 2016 at 11:03