Template Css Overriding 3rd Party Search Input Fields - Question | JoomShaper

Template Css Overriding 3rd Party Search Input Fields

J

joanne

Helix Framework 3 months ago

Hello,

There is a template override causing a display issue on a JBusiness Directory Search bar. How can I set the padding to none?
Please see snippet of code below from JBusiness Directory support who states that the padding on the input fields should not be enforced.

input[type="text"]:not(.form-control),input[type="email"]:not(.form-control),input[type="url"]:not(.form-control),input[type="date"]:not(.form-control),input[type="password"]:not(.form-control),input[type="search"]:not(.form-control),input[type="tel"]:not(.form-control),input[type="number"]:not(.form-control),select:not(.form-select):not(.form-control) { display: block; width: 100%; padding: 0.5rem 0.5rem !important;

screenrec.com/share/jnXtzEbdCB

Thank you,
0
11 Answers
J
joanne
Accepted Answer
3 months ago #157602

Thanks Pavel,

This block of code fixed the issue. I agree, we have enough conflict these days without code conflicts.

You really helped me out here and I truly appreciate the time you took to do this. I wouldn't be using the JBusiness Directory except it was in already installed in an existing site I just upgraded.

Thanks again!

0
Mehtaz Afsana Borsha
Mehtaz Afsana Borsha
Accepted Answer
Support Agent 3 months ago #157308

Hi

Thanks for contacting us. Could you please give me your site URL and also a sreenshot of that portion which you want to change?

-Regards.

0
Pavel
Pavel
Accepted Answer
3 months ago #157325

How can I set the padding to none?

Hi.

You can not set it to none since any changes in the template code will be lost after the template update.

Explore the Business Directory Search Bar through your browser Dev Tools to determine the values of padding and parent selector that are from Business Directory Search Bar css. Insert code snippet that you provided into custom.css file adding a parent selector to it and the values from CSS of Business Directory Search Bar .

For example

.PARENT_SELECTOR :is(input[type="text"]:not(.form-control),
input[type="email"]:not(.form-control),
input[type="url"]:not(.form-control),
input[type="date"]:not(.form-control),
input[type="password"]:not(.form-control),
input[type="search"]:not(.form-control),
input[type="tel"]:not(.form-control),
input[type="number"]:not(.form-control),
select:not(.form-select):not(.form-control)) {
    padding: /*values from CSS of Business Directory Search Bar */ !important;
}
0
J
joanne
Accepted Answer
3 months ago #157414

Pavel, thank you for your direction, however, I am unable to get it fixed using your method of which I cannot do. When I passed this on to CMSJunkie and asked for additional help with what you outlined their response is: "They should remove the !important tag as this will enforce the padding on all elements on the website."

What to do!?

0
Pavel
Pavel
Accepted Answer
3 months ago #157444

"They should remove the !important tag as this will enforce the padding on all elements on the website."

Hi. This is true.

You can delete this from template.css. But the update of the template will return it back. Perhaps the JoomShaper team had a good reason to use !important. Although I never found this reason for several years. I think the team should look at this and fix it in the next update.

Therefore, while this is not fixed, the best way out is to use "my" method.

Provide a public link to the page containing the problem and I can help you with "my" method. I am not an employee of support, so I can only see a public link. Access to admin is not required.

0
J
joanne
Accepted Answer
3 months ago #157521

Thank you, I appreciate you taking a look at this. You'll see the search and location input bars here:

https://dev.hanoverlantern.com/dealer-locations

0
Pavel
Pavel
Accepted Answer
3 months ago #157573

Hi.

This should help.

#searchform .form-field select,
#searchform .form-field input[type="text"] {
    width: 200px !important;
}
.jbd-container .has-jicon-left > input[type="text"]:not(.form-control) {
    padding-left: 36px !important;
}

However, for the sake of justice, it is worth noting that the default code from JBusiness team is very far from ideal. If they wrote their code differently, with concern about eliminating all possible conflicts (which is not difficult), then this problem would not have arisen at all.

0
J
joanne
Accepted Answer
3 months ago #157662

Pavel,

How can this code be adjusted for smaller devices? The @media only rule is the way but I'm unsure how to integrated the code you supplied.

Thank you

0
Pavel
Pavel
Accepted Answer
3 months ago #157710

Hi. Here is

/*Breakpoints*/
/* Desktop First */
@media (max-width: 1399.98px) {
    /* your code goes here */
}
@media (max-width: 1199.98px) {
    /* your code goes here */
}
@media (max-width: 991.98px) {
    /* your code goes here */
}
@media (max-width: 767.98px) {
    /* your code goes here */
}
@media (max-width: 575.98px) {
    /* your code goes here */
}

/* Mobile First */
@media (min-width: 576px) {
    /* your code goes here */
}
@media (min-width: 768px) {
    /* your code goes here */
}
@media (min-width: 992px) {
    /* your code goes here */
}
@media (min-width: 1200px) {
    /* your code goes here */
}
@media (min-width: 1400px) {
    /* your code goes here */
}

Always keep it at the very bottom of your CSS file, in such order.

0
J
joanne
Accepted Answer
3 months ago #157748

Most appreciated Pavel. Thank you.

0