Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS Font-size not working properly on mobile device

I'm working on a small project for school, where we have to incorporate html5 and css3. It's just in the begin stage now, as I'm trying to create two separate css-files for a mobile and a desktop version.

For the mobile version, I'm trying to get the menu to just show as a list, but with a bigger font. I can in no way get this working though.

This is the css for the menu:

nav ul {
    list-style: none;
    background-color: green;
    padding: 0;
}

nav li {
    border-bottom: 1px solid black;
    padding: 5px;
}

nav {
    margin-top: -36px;
    width: 100%
}

nav h1{
    margin: 0;
}

This creates the following on my desktopDesktop with 1em And on my iPhoneiPhone with 1em

The font-size is set to 1em in the HTML in the top of the file. But 1em is not big enough for mobile devices, so I want it bigger, which seems impossible.

Even when I give the nav h1 a font-size of 10em, it doesn't get bigger than this: iPhone with 10em

While on my desktop it does work without a problem, there it looks like this:Desktop with 10em

The same problem occurs when trying to make the "blog posts" bigger, they just won't do it.

I normally have no trouble working with CSS, but this time I can't figure it out. Hope anyone can help! I have the feeling it's something very obvious.

Here is the complete CSS: http://snipt.org/zLic5

Here is the html: http://snipt.org/zLid2

like image 924
Rvervuurt Avatar asked Feb 01 '13 01:02

Rvervuurt


People also ask

How do I make text smaller in CSS mobile?

The ideal base font size for mobile screens is 16 pixels. Anything smaller and users will have to pinch and zoom to read. In your site's CSS, it's recommended to set the font-size attribute in "ems" to make it more easily scaled. Using ems is helpful because it changes text relative to the size set in the document.

What font size is readable on mobile?

In general, the rule of thumb is that font size needs to be 16 pixels for mobile websites. Anything smaller than that could compromise readability for visually impaired readers.

How do I increase the font size on my mobile phone?

To make your font size smaller or larger: On your device, open the Settings app. Search and select Font size. To change your preferred font size, move the slider left or right.


1 Answers

i saw your html code. you are not adding any meta tag. certain meta tags are required, when you are developing mobile website,

for example you have to add -

<meta name="HandheldFriendly" content="true" />
<meta name="MobileOptimized" content="320" />
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width, user-scalable=no" />
<title>Welcome to your school name</title>

<!-- smart phone css  -->
<link href="assets/phone.css" rel="stylesheet" type="text/css" media="all and (min-width: 0px) and (max-width: 480px)" />

<!-- Tablet -->
<link href="assets/tablet.css" rel="stylesheet" type="text/css" media="all and (min-width: 481px) and (max-width: 800px)" />

<!-- Desktop -->
<link href="assets/desktop.css" rel="stylesheet" type="text/css" media="only screen and (min-width:801px)">
like image 143
naresh kumar Avatar answered Oct 16 '22 09:10

naresh kumar