Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6560587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:28:46+00:00 2026-05-25T13:28:46+00:00

I have a simple static website with a couple lines of text in it.

  • 0

I have a simple static website with a couple lines of text in it.

It will be accessed only from mobile devices, and I want that the font size for the text will be 1/3rd of the screen’s height and lines to word wrap based on the screens width.

can it be done using CSS & HTML only? if so how?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:28:47+00:00Added an answer on May 25, 2026 at 1:28 pm

    The simple answer is to programmatically serve a stylesheet based on the mobile device. You can do this in your CSS file with :

    @media screen and (max-device-width: 480px) {
      font-size: 160px; /* 1/3 max screen height */
    }
    

    Alternately, you could use javascript to calculate the width and height of the viewport then set the style dynamically.

    window.onload = function() {
      var viewportwidth;
      var viewportheight;
    
      if (typeof window.innerWidth != 'undefined') {
          viewportwidth = window.innerWidth,
          viewportheight = window.innerHeight
      } else if (typeof document.documentElement != 'undefined'
        && typeof document.documentElement.clientWidth !=
        'undefined' && document.documentElement.clientWidth != 0) {
          viewportwidth = document.documentElement.clientWidth,
          viewportheight = document.documentElement.clientHeight
      } else {
          viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
          viewportheight = document.getElementsByTagName('body')[0].clientHeight
      }
      document.body.style.fontSize = viewportheight / 3;
    }
    

    Set wordwrapping in CSS with white-space: normal and, if desired, word-wrap:break-word

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are currently designing a website that will be accessed from kiosks in a
I have made a simple web-page including a couple of static pages, a css
I have done a couple of simple swing based apps with static layout, but
I have a simple website(primarily static html/css) but for some reason some of the
I have a simple html page that only uses PHP in two places <?php
I have a simple static website, based on HTML 5 boilerplate and the whole
I have a simple website in django where the content is static. Where i
I have built a simple static website using media queries to resize for tablets
I have a simple function as the following: static Task<A> Peirce<A, B>(Func<Func<A, Task<B>>, Task<A>>
So I have a simple method called Invert : public static void Invert(this bool

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.