Create Beautiful Restaurant Menus
I love doing tutorials about Divi, but also CSS and jQuery. This tutorial is about a CSS trick to add leading dotted lines and create a list of things with label text on the left and a value text on the right. The most obvious use case for this is a restaurant menu, but there are other things you could o with it as well. In this tutorial, I will show you how to add automatic dotted leader lines between text in Divi.
▶️ Please watch the video above to get all the exciting details! 👆
1. Set Up The List Of Items
The first step in the tutorial is to set up the list of items by adding the label and value text. The way this will work, you need to add the items as an unordered list, or bullet list. For each bullet list item, add the label text which will be on the left and also the value text which will be on the right. The important part now is adding span tags to each of those. It’s quite easy to do, and once you do one you can copy and paste it for others.
The important part now is adding span tags to each of those. It’s quite easy to do, and once you do one you can copy and paste it for others. To do this, switch to the “Text” tab with is actually the “HTML” tab. This allows you to see the HTML, which is what we need to edit. Look inside the <li> (list item) and you will see your text. Add <span> before and </span> after your label text and do the same for your value text.
If you need any help with this, please watch the video. We also include an HTML version of the list item you can copy below.
HTML Of Each List Item
<li><span>LABEL</span><span>VALUE</span></li>
2. Add A Custom CSS Class To The Divi Module
There is one more step to do while inside that “Text” tab. You need to have a CSS class so that the code snippet we add in step #3 will connect with the bullet list you just added in step #1. We could have made this work with a slightly different process by adding the class to the main module, but this approach allows you to use this tutorial within any module by targeting the bullet list instead of the module.
Go to the <ul> (unordered list) at the beginning of the code and add the CSS class “pa-dot-leaders” inside the brackets. Here is the exact HTML of the ul:
HTML Of Unorderd List
<ul class="pa-dot-leaders">
3. Add The Custom CSS Code Snippet
Now it’s time to do the real trick here, adding the code that creates the leading dotted ones and spreads the label and value text to each side. The code is a little complicated, so sorry but I won’t take much time to explain it this time. Just copy and paste!
Where To Paste The CSS Code
1. Divi Assistant
If you are using our Divi Assistant plugin, simply paste the code in the CSS tab in the custom code window in the Divi Visual Builder.
2. Child Theme
If you are using a child theme, paste this code into the style.css file. If you don't have a child theme, you can generate a child theme directly on your site or download our free child theme.
3. Divi Theme Options Integration
Otherwise, paste this code in your Divi>Theme Options>Custom CSS code box.
If you need help understanding where to paste the code, please check out our complete guide about where to add custom code In Divi.
ul.pa-dot-leaders {
max-width: 40em;
padding: 0;
overflow-x: hidden;
list-style: none}
ul.pa-dot-leaders li:before {
float: left;
width: 0;
white-space: nowrap;
content:
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "
}
ul.pa-dot-leaders span:first-child {
padding-right: 0.33em;
background: white}
ul.pa-dot-leaders span + span {
float: right;
padding-left: 0.33em;
background: white}
Be sure to watch the video to see this all in action, as this tutorial is a bit more complicated than usual. Let me know in the comments if you enjoyed this!
Hi Knox!
Sorry, I’m not able to see the screenshot link. I need to see the HTML in order to filter out the issue. Can you please share the URL of the page to investigate further?