Contact button color

  • Posts: 7
  • Thank you received: 0
  • Hikashop Business
8 hours 19 minutes ago #369257

-- HikaShop version -- : 6.1.0
-- Joomla version -- : 6.0.0
-- PHP version -- : 8.3.27
-- Browser(s) name and version -- : Any

Hello, good day.

I'd like to change the color of the contact button, but I'm having trouble doing it correctly.

If I add custom CSS to my template's background-color in .hikabtn, it also affects the form buttons (OK and Cancel).

If I modify the background color in the hikashop.css file, no changes occur. (Line 976)
.hikabtn,
.hika_j2 .btn {
text-decoration: none;
color:#333;
background-color:#eaedf0;
}

I need to change the color of the contact button without affecting the other buttons in Hikashop.

I hope you can help me.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 84640
  • Thank you received: 13767
  • MODERATOR
4 hours 55 minutes ago #369258

Hi,

First, you should NOT change the CSS code in the file hikashop.css.
Next time you update HikaShop, you'll lose your changes.
Instead, you should write CSS code to override the default CSS and add it to your Joomla template.
Most templates have a mechanism to add custom CSS.
I checked your website and it seems that you're using a template based on the Astroid framework. So this should be how to add custom CSS on your website:
docs.astroidframe.work/custom-code/custom-css
Just copy / pasting the CSS from hikashop.css there and modifying it should do it.
The fact that no change occurred when you changed the CSS of hikashop.css is because of your template. It has a caching mechanism for the CSS. So, unless you clear the template's cache, you won't see a change. You can see on the Astroid documentation page above that it recommend clearing the cache of the template after adding your custom CSS code.

However, just copy / pasting the CSS code is a crude way to go about it and won't allow you to segregate elements with the same class in different areas like you want to do.
Instead of just copy / pasting the CSS code, you can use the inspector tool of your browser to study how the HTML elements are on the area you want to change.
So, if you check the HTML of your contact button, you'll see this:

<div id="hikashop_product_contact_main" class="hikashop_product_contact_main">
   <a class="hikabtn" rel="nofollow" href="/nuestros-productos/maquinas-y-equipos-de-aseo/apiradoras/product/contact/cid-169">
       <span>
           <i class="fa-solid fa-comment"></i>
           <font color="green">Consulta por este producto</font>
       </span>
    </a> 
</div>
And as you found out already, the background color of the button is linked to the generic hikabtn class.
And you can see that the HTML element of that hikabtn class is inside a div element with the class hikashop_product_contact_main.
A key concept in CSS is combinators:
developer.mozilla.org/en-US/docs/Web/CSS...escendant_combinator
So, what you want to do is to write CSS like this:
.hikashop_product_contact_main .hikabtn{
  bakground-color : #eaedf0 !important;
}
This way, your background color will only apply to the elements with the hikabtn class if they are inside an element with the class hikashop_product_contact_main.
The !important will allow you to force the browser to use your background color instead of the default one in case your CSS code is processed before the default CSS of HikaShop:
developer.mozilla.org/en-US/docs/Web/CSS...nce/Values/important
It might actually not be necessary based on how your template loads the CSS on the page.

The following user(s) said Thank You: KEKO512

Please Log in or Create an account to join the conversation.

  • Posts: 7
  • Thank you received: 0
  • Hikashop Business
4 hours 20 minutes ago #369259

Thank you very much, that solved it for me.

Please Log in or Create an account to join the conversation.

Time to create page: 0.060 seconds
Powered by Kunena Forum