Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi guys,
I added the code in 'Sections' for announcement-bar.liquid and it worked great! Only thing is I can't work out how to reduce the height of the announcement bar at the very top of the page. I have turned it off because it's too ugly (almost double the height I want it to be because I want it to be identical to the one under the header).
Any ideas how I can edit the code to reduce the height? I'll copy/paste the code from announcement-bar.liquid below in case that helps. Thanks so much if you can help!
<style>
.announcement-bar {
background-color: {{ section.settings.announcement_bar_color }};
text-align: center;
text-decoration: none;
}
.announcement-bar__message {
font-size: large;
padding: 0px;
color: {{ section.settings.announcement_bar_text_color }};
}
</style>
{%- if section.settings.show_announcement -%}
{%- if section.settings.home_page_only == false or template.name == 'index' -%}
{%- if section.settings.link == blank -%}
<div class="announcement-bar">
{%- else -%}
<a href="{{ section.settings.link }}" >
{%- endif -%}
<p class="announcement-bar__message">{{ section.settings.text | escape }}</p>
{%- if section.settings.link == blank -%}
</div>
{%- else -%}
</a>
{%- endif -%}
{%- endif -%}
{%- endif -%}
{% schema %}
{
"name": "Announcement bar",
"settings": [
{
"type": "checkbox",
"id": "show_announcement",
"label": "Show announcement",
"default": false
},
{
"type": "checkbox",
"id": "home_page_only",
"label": "Home page only",
"default": true
},
{
"type": "color",
"id": "announcement_bar_color",
"label": "Background color",
"default": "#000000"
},
{
"type": "color",
"id": "announcement_bar_text_color",
"label": "Text color",
"default": "#ffffff"
},
{
"type": "text",
"id": "text",
"label": "Announcement text",
"default": "Announce something here"
},
{
"type": "url",
"id": "link",
"label": "Announcement link"
}
]
}
{% endschema %}
Hi @Caneleo1234,
Please change code CSS:
.announcement-bar {
background-color: {{ section.settings.announcement_bar_color }};
text-align: center;
text-decoration: none;
}
.announcement-bar__message {
font-size: large;
padding: 0px;
color: {{ section.settings.announcement_bar_text_color }};
}
=>
.announcement-bar {
background-color: {{ section.settings.announcement_bar_color }};
text-align: center;
text-decoration: none;
padding: 5px 0;
}
.announcement-bar__message {
font-size: 15px;
padding: 0px;
color: {{ section.settings.announcement_bar_text_color }};
margin-bottom: 0;
}
Hope it helps!
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024