Home › Blog › Divi Tutorials ›  Divi Buttons

Custom Divi Buttons

Divi Button

The Result (Live Action)

Instruction

1. Add o2-lines-corners in your button CSS Class

2. Place CSS Code in Theme Options → General → Custom CSS

3. Change border width, style, color and background to suit your brand

CSS Code

/* START custom buttons */
/* Static state: ensure all borders are removed, then add only the bottom border */
#page-container .et-l .et_pb_section .et_pb_button.o2-lines-corners {
border: none !important;
border-bottom: 1px solid #fff !important;
}
/* Hover state: Hide the static bottom border and add the new background color */
#page-container .et-l .et_pb_section .et_pb_button.o2-lines-corners:hover {
border-bottom: none !important;
background-color: #262626 !important;
}
/* Hover state: This is the original code for the animated pseudo-elements */
.o2-lines-corners {
–border-width: 1px;
–border-color: #fff;
}
#page-container .et-l .et_pb_section .et_pb_button.o2-lines-corners::before,
#page-container .et-l .et_pb_section .et_pb_button.o2-lines-corners::after {
display: block !important;
margin: 0;
content: ”;
border-radius: inherit;
border-width: var(–border-width);
border-color: transparent;
border-style: solid;
opacity: 1;
width: 0;
height: 0;
transition: all 0.5s ease-in-out;
}
#page-container .et-l .et_pb_section .et_pb_button.o2-lines-corners::before {
top: calc(var(–border-width) * (-1));
left: calc(var(–border-width) * (-1));
bottom: auto;
right: auto;
border-right: none;
border-bottom: none;
}
#page-container .et-l .et_pb_section .et_pb_button.o2-lines-corners::after {
top: auto;
left: auto;
bottom: calc(var(–border-width) * (-1));
right: calc(var(–border-width) * (-1));
border-left: none;
border-top: none;
}
#page-container .et-l .et_pb_section .et_pb_button.o2-lines-corners:hover::before,
#page-container .et-l .et_pb_section .et_pb_button.o2-lines-corners:hover::after {
width: calc(100% + var(–border-width));
height: calc(100% + var(–border-width));
border-color: var(–border-color);
}
/* END custom buttons */

Request Your Free Consultation

Let’s Talk About Your Project & Goals