CSS媒体查询字体

时间:2015-06-24 10:17:45

标签: css3

我已经在电子商店的每个最新设备中查看了我的页面。

我不能让我的生活得到正确的字体。最新的三星星系在最新的ipad等中是多么微小。

body {

    font-size: 62.5%;
    line-height: 1.45em;
}
.p {
    font-size: 1.7em;
}
@media only screen and (max-width: 1280px) {
    .p {
        font-size: 1.842857142857143em;
    }
}
@media only screen and (max-width: 1024px) {
    .p {
        font-size: 1.842857142857143em;
    }
}
@media only screen and (max-width: 800px) {
    .p {
        font-size: 2em;
    }
}
@media only screen and (max-width: 600px) {
    .p {
        font-size: 1.9em;
    }
}
@media only screen and (max-width: 320px) {
    .p {
        font-size: 1.9em;
    }
}
@media only screen and (max-width: 320px) {
    .p {
        font-size: 1.9em;
    }
}

我到底做错了什么?

请帮忙。感谢

2 个答案:

答案 0 :(得分:0)

您可以使用Viewport设置许多屏幕尺寸的字体大小。 这里有一些关于它的信息:

https://css-tricks.com/viewport-sized-typography/

浏览器支持列表:

http://caniuse.com/#feat=viewport-units

答案 1 :(得分:0)

狂野猜测: if (resultCode == RESULT_OK && requestCode == ACTION_REQUEST_GALLERY) { Uri selectedImageUri = data.getData(); String[] projection = {MediaStore.MediaColumns.DATA}; Cursor cursor = managedQuery(selectedImageUri, projection, null, null, null); int column_index = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA); cursor.moveToFirst(); String selectedImagePath = cursor.getString(column_index); BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(selectedImagePath, options); final int REQUIRED_SIZE = 200; int scale = 1; while (options.outWidth / scale / 2 >= REQUIRED_SIZE && options.outHeight / scale / 2 >= REQUIRED_SIZE) scale *= 2; options.inSampleSize = scale; options.inJustDecodeBounds = false; bitmap = BitmapFactory.decodeFile(selectedImagePath, options); } 应为.p。您正在选择一个类而不是一个元素。