Jump to content

Archived

This topic is now archived and is closed to further replies.

mpturner

Masthead Font Changes = Non-Responsive

Recommended Posts

mpturner

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
Danny
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;
}

Please search our forums, before posting!

Share this post


Link to post
Share on other sites
mpturner

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
Rob

Use em or percent sizing, instead of px.


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
mpturner

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
Danny

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.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
Frederic

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
Danny

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.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites

  • Similar Content

    • Michael Kummer
      By Michael Kummer+
      Hi guys!
      I have noticed that my primary sidebar becomes intermittently invisible when browsing through various blog articles on michaelkummer.com/blog.
      See:
      https://www.dropbox.com/s/z646sgoa3mfjl1j/Screenshot 2018-07-12 15.57.46.jpg?dl=0 and https://www.dropbox.com/s/vdledzzgginvwgv/Screenshot 2018-07-12 15.57.57.jpg?dl=0
      Upon refresh, the sidebar appears. I have been using the following CSS code to hide the sidebar on mobile without any issues. 
      @media only screen and (max-width: 993px) {
      /* hide sidebars */
           .plsb {
              display: none !important;
          }
      }
      I tried to add the following CSS to force the sidebar to show on screens that are wider than 994 pixels but to no avail. Any clue what could be causing this issue?
    • Michael Kummer
      By Michael Kummer+
      Hi guys!
      I am using the LESS/CSS Pagelines extension and tried to add the following code to make use of FontAwesome:
      a.c2a:before {
          content: "\f07a\00a0";
          font-family: "Font Awesome 5 Pro";
          Font-weight: 900;
          font-style: normal;
          font-weight: normal;
          text-decoration: inherit;
          padding-left: 4px;
      }
       
      The issue is that as soon as I have the CSS via the Custom Styling text box, Pagelines (or the extension) strips out the backslashes (\). As a result, I had to abandon the CSS/LESS extension and instead add all my CSS code to a separate .css file.
      Is there a fix or workaround for this?
      Thanks
      Michael
    • glyph.marketing
      By glyph.marketing+
      Hello, I am having a problem similar to that experienced by Michael Kummer here. We have pages that show this automatic scrolling issue (examples here and here) and it is sufficiently annoying that we have seen customers bounce while trying to convert. Strangely, it only happens at specific resolutions, so it can be difficult to reproduce. In general we can only consistently reproduce it on a 4k resolution with a browser width between 1517 and 1536px. 
      Thanks to Michael Kummer's help we were able to set the overflow-anchor property to none in the entire body, which fixed the issue as far as we can tell, but also obviously disabled scroll anchoring for the whole site. I tried applying it to the specific element that looked like it was being reloaded, which was the PL Meganav extension, but that was unsuccessful. 
      Can anyone help us figure out which element or ID we can apply this property to, so that we can fix the scrolling issue but not disable scroll anchoring for the entire site?
      Thank you - 
      Glyph Language Services
    • chamois_blanc
      By chamois_blanc+
      Hello,
      Shouldn't the image PL5 component be using the srcset/picture css directives to pick the correct size for an image? or it does already and I don't know how to use it? Thank you for any advice or enlightenment.
    • stijnxo
      By stijnxo+
      Is there a way to disable the responsive function of your iBoxes?
      I do not want all iBoxes underneath each other on mobile, is there a way to fix columns or group boxes?
      I use them for small links and want them to stay next to each other, see attachment
      Please let me know.



×