- This topic has 9 replies, 3 voices, and was last updated 4 years, 6 months ago by
Leo.
-
AuthorPosts
-
September 15, 2021 at 7:59 pm #1932060
Tim
Hello
An author of posts would like to selectively (per line) replace the bullet points available in the GP Theme with an icon such as a Font Awesome icon like
fas fa-check-circlehttps://fontawesome.com/v5.15/icons/check-circle?style=solidHow can I implement this cleanly to give the user a UI friendly way to apply this ?
Thanks
September 15, 2021 at 10:38 pm #1932139Elvin
StaffCustomer Supporthi Tim,
Can you link us to the page w/ the bullet points? So we can instead and get the right selectors for you to use. 🙂
While waiting, here’s a warning:
Your site may take a performance hit for using FontAwesome.
That said, consider using an SVG instead of a font icon so you don’t have to load a whole font set just to replace a list decoration. 🙂
September 16, 2021 at 8:44 pm #1933274Tim
Hello Elvin
Thank you for your support.
I guess this is
ul li::markerLink provided.
September 16, 2021 at 8:54 pm #1933280Elvin
StaffCustomer SupportYes but that’s defined by this:
ul { list-style: disc; }What you’d have to do is set it to
list-style: none;and then add a pseudo element to replace it.This article explains it in details – https://web.dev/css-marker-pseudo-element/
September 17, 2021 at 4:28 am #1933563Tim
Hello Elvin
Thank you for the support.
OK in principle I can see what needs to be done there,
but what I was wondering is,
how I can make the style available to the user, via the WYSIWYG editor, to apply to selected lines rather than apply the style to all
ul?Thanks
Tim
September 17, 2021 at 10:07 am #1933976Leo
StaffCustomer SupportYou would need to add a custom class to the list and target your CSS specifically to that class.
September 17, 2021 at 9:33 pm #1934360Tim
Hello Leo
Thank you for the support.
I’m just going back a step, and following Elvin’s suggestion, I’m attempting to implement a single svg. From the cited page I’m trying to follow the example given.
ul { list-style: none; } .entry-content ul li::marker { content: url(/wp-content/ui/check-circle.svg); }What is the best way to control the position such that the icon’s center appears roughly the same as the line of text, and also to put some space between the icon and the line of text ?
Thanks
September 18, 2021 at 11:36 am #1934971Leo
StaffCustomer SupportI think the best way to achieve what you have is to use the headline blocks with icons from GenerateBlocks:
https://docs.generateblocks.com/article/headline-overview/It has options like icon size, alignment and padding:
https://docs.generateblocks.com/article/headline-overview/#iconIt would be a lot easier if you are not comfortable with CSS.
You can see an example in the pricing table towards the bottom of this page:
https://generatepress.com/premium/September 18, 2021 at 8:51 pm #1935208Tim
Hello Leo
Thank you for the support.
Perhaps using the generate blocks is the way to go, but since content had already been created on the site I wanted to target the existing selector and modify in CSS.
What I have found is that when targeting
li::markerchanging thecolorin CSS does not render, nor didfill,width,heightorpadding. So I instead set thecolor,widthandheightin the svg and then targetedli::beforeto set thecontentandpadding, which worked.ul { list-style: none; } .entry-content ul li::before { content: url(/wp-content/ui/check-circle.svg); padding-right: 10px; }<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 512 512"><!-- Font Awesome Pro 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z" fill="#0066b2"/></svg>For color at least I did read that it should be possible to set
fill="currentcolor"in the svg and then modify the color of the containing element, but this didn’t work either.So what I have works, but perhaps it is not best practice and I would prefer to be able to do it all from CSS.
Your thoughts are welcome.
Thanks
September 19, 2021 at 9:35 am #1935814Leo
StaffCustomer SupportLooks good to me if it works for you 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.