• 0

Masthead Font Changes = Non-Responsive


Question

Posted · Report post

Hi all,

 

By default, the Masthead font reduces perfectly on the iPhone, for example. But when I edit the size of the font within CSS, it becomes non-responsive. I've also tried using percentages to no avail. As you can see from my CSS below, I am attempting to make the title smaller and the tagline larger, yet keep it all responsive.

 

Thanks much,

Michael

 

.masthead {
  margin-bottom: 0px !important;
}
 
.masthead .masthead-title {
  color: #4E4F4F !important;
  font-size: 56px !important;  
}
 
.masthead .masthead-tag {
  color: #4E4F4F !important;
  opacity: 1.0 !important;
  font-size: 36px !important;
}
 

Share this post


Link to post
Share on other sites

8 answers to this question

  • 0

Posted · Report post

I haven't checked your code personally as we do not provide assistance to custom code. However, it looks about right, if it doesn't work you may want to prefix your code with one of the PageLines override which are available on our custom CSS documentation.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Hi, This is because by default when you resize your browser the Masthead title is resized using @media queries. Therefore, if you change the font size of the Masthead title, you will also need to do the same i.e. change the font size via @media. Below is the default code for the Masthead and its @media queries.
.masthead .masthead-title {
margin-bottom: 9px;
font-size: 81px;
letter-spacing: -1px;
line-height: 1;
margin-bottom: 18px;
}

@media screen and (max-width: 980px)
.masthead .masthead-title {
font-size: 72px;
}

@media screen and (max-width: 768px)
.masthead .masthead-title {
font-size: 54px;
}

@media screen and (max-width: 480px)
.masthead .masthead-title {
font-size: 45px;
margin-right: 0;
}

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Thanks Danny, however I am confused.

 

In your code above, if I only change the first size (81px) to say... 56px... and don't touch the @media sections, shouldn't those @media options still work as-is since they aren't percentages of the 81px... they are what they are in pixels? I ask, because the font sizes that render on the iPhone are perfect as-is. I only want the desktop version to change, but when I do that, it's breaking the mobile font resizing.

 

Thanks for the help,

Michael

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Use em or percent sizing, instead of px.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

I've tried that, Rob, but no love. I guess I need to read-up on my CSS knowledge. I'm just not getting why changing the primary font size would even impact the @media queries when they have their own font-size that should override any other font settings, provided the screen size matches. But no matter what I do to that very first font-size -- the 81px code -- it ruins responsiveness on the iPhone.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Its most likely that your custom code, is overriding the @media queries and therefore, the @media CSS isn't being used. The best thing to do is, add your own @media queries.

 

The code I provided above will assist you in creating your own @media.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Hi Danny

 

I have read the above codes and found them great as i was also wondering why fonts do not resize when going on ipad or smaller screen.

 

So I will definitely try that.

 

You gave an example for   .masthead .masthead-title 

 

Do I use the same @media screen and (max-width: 768px) with titles in highlight, hero and icall?

 

I have 

.pl-hero-wrap .pl-hero h1   for Hero

.section-highlight .highlight-head   for Highlight

.section-icallout .icallout-head   for iCall

 

Is that ok using:

@media screen and (max-width: 980px)
.section-icallout .icallout-head {
font-size: 72px;
}

@media screen and (max-width: 768px)
.section-icallout .icallout-head {
font-size: 54px;
}

@media screen and (max-width: 480px)
.section-icallout .icallout-head {
font-size: 45px;
margin-right: 0;
}

 

I assume there is not need to do that for the taglines - they would end up too small

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Great, thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now