I’m using a theme called srpout, I’ve cloned it to be able to make modifications, now I don’t know how to make it look good on cell phones, before the CTA looked bad, and I put Withd 100% in the ccs and it worked, but Now how do I improve the view of language on the mobile?
I need help please
this is the header code:
<!--
templateType: global_partial
label: Website header
-->
<header class="header">
<div class="header__container">
{# Logo #}
<div class="header__logo">
{% module 'header_logo'
path='@hubspot/logo',
img={
'alt': 'Sprout logo',
'height': '82',
'src': get_asset_url('../../images/sprout-theme-logo.png'),
'width': '205'
}
%}
</div>
{# End Logo #}
{# Main Navigation #}
<div class="header__menu">
<input type="checkbox" id="nav-toggle">
<label class="header__navigation-toggle" for="nav-toggle">
<span class="header__mobile-menu-icon"></span>
</label>
<div class="header__navigation">
{% module 'header_navigation_primary'
label='Primary navigation',
path='../../modules/menu-section'
%}
</div>
</div>
<!--HubSpot Call-to-Action Code --><span class="hs-cta-wrapper" id="hs-cta-wrapper-e5932b9d-346b-46fd-96af-fa52cf693e5a"><span class="hs-cta-node hs-cta-e5932b9d-346b-46fd-96af-fa52cf693e5a" id="hs-cta-e5932b9d-346b-46fd-96af-fa52cf693e5a"><!--[if lte IE 8]><div id="hs-cta-ie-element"></div><![endif]--><a href="https://cta-redirect.hubspot.com/cta/redirect/7282757/e5932b9d-346b-46fd-96af-fa52cf693e5a" target="_blank" ><img class="hs-cta-img" id="hs-cta-img-e5932b9d-346b-46fd-96af-fa52cf693e5a" style="border-width:0px;" src="https://no-cache.hubspot.com/cta/default/7282757/e5932b9d-346b-46fd-96af-fa52cf693e5a.png" alt="Log In"/></a></span><script charset="utf-8" src="https://js.hscta.net/cta/current.js"></script><script type="text/javascript"> hbspt.cta.load(7282757, 'e5932b9d-346b-46fd-96af-fa52cf693e5a', {}); </script></span><!-- end HubSpot Call-to-Action Code -->
{# End Main Navigation #}
{# Language Toggle #}
<div class="header__row-1">
{% if content.translated_content|length %}
<div class="header__language-switcher header--element">
<div class="header__language-switcher--label">
{% module "language-switcher" path="@hubspot/language_switcher", display_mode='localized', label="Language Switcher" %}
<div class="header__language-switcher--label-current"> {{ locale_name(locale) }}</div>
</div>
</div>
</div>
{% endif %}
{# End Language Toggle #}
</div>
</header>
To comment, the language code is from another theme, because in that it brings the theme by default it had the wrong colors.
Hi Jose,
You’d need to target the header__language-switcher--label class in your css (or one of it’s parent divs) to change the way it looks.
If you can share a link to a page we can get a better look at what css is currently affecting it and help you work out the best solution for styling it.
Hi, @BarryGrennan
at the moment this page is not published, but I share the test link:
https://www.sharemed.app/es/-temporary-slug-069ffc89-3030-45b1-8c98-456077713864?hs_preview=fnkYEkBF-35386754141
this is what you need?
on computer it works fine, but not on mobile
Hi Jose,
Yep that’s great.
You could add something like the below to your css and play around with it:
@media screen and (max-width: 767px) {
.header__container .header__row-1 {
position: absolute;
top: 5px;
right: 0px;
}
/* repositioning cta button*/
.header__container .hs-cta-wrapper {
margin-right:1rem;
margin-left:-2.1rem; /*this minus value is the same as the margin-right on the logo div, alternatively you could set that to zero instead with an !important; */
}
span.header__mobile-menu-icon {
margin-top: 1em; /* aligns it with the cta button slightly better */
}
.header__container {
padding-top:2rem; /* this gives you a little more space between your language switcher and your hamburger menu */
}
}
That get’s it close to what I think you’re looking for. You may need to check the media queries for other screen sizes.
It’d also potentially be cleaner if you structured the html differently (i.e. you wouldn’t need to use the position absolute) but resolving it with css works just as well I suppose. Just make sure to double check it across browsers/different devices.
I really couldn’t, I’m not very skilled with css, I’ve been trying everything
Hi Jose,
Did you try to add the css I put together above? What did it look like then?
When I add in in my inspector stylesheet the site looks like this:
If you’re really struggling with it, it may be worth hiring a developer. There are plenty around here (I’m one too! I’m hubspot CMS certified)
If you required it, feel free to get in contact through my site: seoanseo.ca
wow, it does not come out like that, I will consider your proposal if I do not succeed. Thanks, I’ll keep trying to put what you gave me, what happens is that I don’t put the “@media” in hubspot
Why aren’t you putting the media parameters in? They’re there to only let that css code take effect on mobile devices.
If you put it in without it it would affect the desktop view of the site also.
I am working with a cloned hubspot template, I have edited some things, including adding that CTA that you see in the header, and that is what caused me that the language thing did not appear right, now every time I try to add parameters of “Average” I do not know why it is not working for me, but I will investigate what I am placing wrong
Hi Jose,
I don’t know the structuring of your templates, etc, but Idon’t think that it’s a cloned template should affect it.
You should be able to put the above code in your main.css file to see if it takes effect.
I will try to add that code, to see how I do it
You’re great, I wasn’t looking at the ccs page it was, I put what you told me, now it looks a little better, a little stuck up.
/* Header Container */
.header {
background-color: #34b5e5;
width: 100%;
z-index: 3;
}
.header__container {
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
margin: 0 auto;
max-width: 1340px;
padding: 1.4rem 2.8rem;
position: relative;
}
@media screen and (max-width: 767px) {
.header__container .header__row-1 {
position: absolute;
top: 5px;
right: 0px;
}
/* repositioning cta button*/
.header__container .hs-cta-wrapper {
margin-right:1rem;
margin-left:-2.1rem; /*this minus value is the same as the margin-right on the logo div, alternatively you could set that to zero instead with an !important; */
}
span.header__mobile-menu-icon {
margin-top: 1em; /* aligns it with the cta button slightly better */
}
.header__container {
padding-top:2rem; /* this gives you a little more space between your language switcher and your hamburger menu */
}
}
/* Logo */
.header__logo {
margin-right: 2.1rem;
}
.header__logo img {
height: auto;
max-width: 250px;
}
.header__logo .logo-company-name {
color: #1e2b33;
font-size: 28px;
}
/* Navigation Menu */
.header__menu {
margin-left: auto;
}
@media screen and (max-width: 767px) {
.header .header__menu {
margin-left: 0;
min-height: 0;
-webkit-box-ordinal-group: 4;
-ms-flex-order: 3;
order: 3;
}
}
/* Language Switcher */
.header__language-switcher {
cursor: pointer;
margin-left: 2.1rem;
}
.header__language-switcher .lang_switcher_class {
position: static;
}
.header__language-switcher .lang_switcher_class .globe_class {
background-color: #fff;
border: 1px solid #fff;
border-radius: 50%;
margin-top: 5px;
}
.header__language-switcher .lang_list_class {
background-color: #34b5e5;
border-color: #d0d0d0;
border-radius: 0 0 4px 4px;
border-style: solid;
border-width: 1px;
display: block;
left: auto;
min-width: 100%;
opacity: 0;
padding-top: 0;
right: 0;
text-align: left;
-webkit-transform: none;
-ms-transform: none;
transform: none;
top: 100%;
visibility: hidden;
}
.header__language-switcher:hover .lang_list_class {
opacity: 1;
visibility: visible;
}
.header__language-switcher .lang_list_class:after,
.header__language-switcher .lang_list_class:before {
content: none;
}
.header__language-switcher .lang_list_class li {
background-color: transparent;
border: none;
line-height: 2;
margin: 0;
padding: 10px;
}
.header__language-switcher .lang_list_class li:first-child {
border-top: none;
padding-top: 0.7rem;
}
.header__language-switcher .lang_list_class li:last-child {
border-bottom: none;
padding-bottom: 0.7rem;
}
.header__language-switcher .lang_list_class li:hover {
background-color: #c168c2;
-webkit-transition: background-color 0.3s;
-o-transition: background-color 0.3s;
transition: background-color 0.3s;
}
.header__language-switcher .lang_list_class li:hover a {
color: #fff;
}
.header__language-switcher-label-current,
.header__language-switcher .lang_list_class li a {
color: #fff;
font-family: 'Work Sans', sans-serif;
font-size: 1rem;
font-weight: 400;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.header__language-switcher-label {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
position: relative;
}
.header__language-switcher-label-current {
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
line-height: 2;
margin-left: 0.7rem;
}
.header__language-switcher-label-current:hover,
.header__language-switcher-label-current:focus,
.header__language-switcher-label-current:active {
color: #fff;
}
.header__language-switcher-label-current:after {
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-top-color: #fff;
border-top-style: solid;
border-top-width: 6px;
content: '';
display: block;
height: 0;
margin: 3px 0 0 10px;
width: 0;
}
@media(max-width: 767px) {
.header__language-switcher {
margin-left: auto;
margin-right: 20px;
-webkit-box-ordinal-group: 3;
-ms-flex-order: 2;
order: 2;
}
.header__language-switcher .lang_switcher_class .globe_class {
height: 24px;
margin-top: 0;
width: 24px;
}
.header__language-switcher .lang_list_class {
border: 0;
border-radius: 0;
}
.header__language-switcher:hover .lang_list_class {
opacity: 0;
visibility: hidden;
}
.header__language-switcher .lang_list_class li {
border-top-color: #d0d0d0;
border-top-style: solid;
border-top-width: 1px;
padding: 0.7rem;
}
.header__language-switcher .lang_list_class li:first-child {
border-top: 1px solid #d0d0d0;
padding-top: 0.7rem;
}
.header__language-switcher .lang_list_class li:hover {
background-color: transparent;
}
.header__language-switcher .lang_list_class li:hover a {
color: #fff;
}
.header__language-switcher-label {
position: static;
}
.header__language-switcher-label-current {
display: none;
}
.header__language-switcher.open .lang_list_class {
opacity: 1;
visibility: visible;
}
}
/* Header - No Navigation */
.header--no-navigation .header__container {
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
}
.header--no-navigation .header__logo {
margin-right: 0;
}
Glad I could help Jose.
I’d appreciate it if you marked my answer as the solution to your problem.
If you require further assistance with the layout, feel free to get in contact with me here: seoanseo.ca
Many thanks..
I will keep it in mind, already save your website.