Is it possible to make font according to screen size?

Discussion in 'HTML & Website Design' started by Anusha55, Feb 17, 2016.

  1. #1
    I have a website where we have put the link as in two rows not as menu. Each row have some links as menu for each of my pages in the website. The links or menu we called them have two words as anchor text, but problem is that they overlap to each other on small screen. So i want them to be in straight line. Is it possible so we can reduce font size based on Screen and keep the two words in a line.

    Do you have any other idea you can state it as well.
     
    Anusha55, Feb 17, 2016 IP
  2. hdewantara

    hdewantara Well-Known Member

    Messages:
    538
    Likes Received:
    47
    Best Answers:
    25
    Trophy Points:
    155
    #2
    Hi Anusha55. I presume they're just regular text, and so perhaps you should try disabling white-space wrap first for the container of those two?

    Hendra
     
    hdewantara, Feb 18, 2016 IP
  3. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    7,279
    Likes Received:
    1,696
    Best Answers:
    31
    Trophy Points:
    475
    #3
    You can do @media query:

    
    @media (max-width: 768px)
    {
    .your_div {
    font-size: 13px;
    }
    }
    
    Code (markup):
    Change the "your_div" to the div you're using for those links.
     
    qwikad.com, Feb 18, 2016 IP
  4. Quadropus

    Quadropus Active Member

    Messages:
    18
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    63
    Digital Goods:
    1
    #4
    You can use percentage based font size, ems, or media queries. A good tutorial here:
    https://viljamis.com/2012/scaling-with-em-units/
     
    Quadropus, Feb 18, 2016 IP
  5. Phil S

    Phil S Member

    Messages:
    60
    Likes Received:
    18
    Best Answers:
    4
    Trophy Points:
    35
    #5
    You'd have to use both, but you're right. Something similar to what @qwikad.com suggested, minus the fixed PX declaration.
    @media screen and (max-width:value) {
        element a{
            font:normal 80%/100% arial,helvetica,sans-serif;
        }
    }
    HTML:
    Though he's probably right, the fonts are already fixed so no scaling can possibly happen there. As much as font-size:13px seems bad, it's completely equivalent to an em/% value.
    And this is the reason : body { font-size: 16px; } People, don't ever do this!
     
    Phil S, Feb 18, 2016 IP
  6. Anusha55

    Anusha55 Active Member

    Messages:
    123
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    73
    #6
    White space are not helping much as the text go down in small screen and it look bad.

    Ok I will try it. Since I am doing it on Wordpress, will it effect all over the sites. I have to clearly do css and use the proper class as you sated.

    That is great but I don't want every text to go like that
     
    Anusha55, Feb 19, 2016 IP