适用于所有移动分辨率的响应式CSS

anji

我想为移动设备设计一个(人像和风景视图)。我想在视图为纵向时将宽度设置为100%,在视图为横向时将宽度设置为50%。

我知道使用媒体查询非常容易。但是无法针对所有设备修复此问题。分辨率这么多,横向和纵向视图是否有特定的CSS?

        .main_cont {overflow:hidden; position:fixed}
        .box1 {
        background:pink}
         .box2 {
        background:lightblue}



        @media screen and (max-width:640px) {
            .box1, .box2 {
            float:left; width:50%; }
        }
<div class="main_cont">

        <div class="box1">
            Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

        </div>

         <div class="box2">
             Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

         </div>

    </div>

在此处输入图片说明在此处输入图片说明

用户名

试试这个:

  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>


<style>



    .box1{

        background:#FFC0CB;

        width:50%;
        float:left;

        }
    .box2{

        background:#ADD8E6;

        width:50%;
        float:left;

        }


/*Portrait Tablet*/
@media only screen and(min-width: 481px) and (max-width: 768px)and (orientation:Portrait){

        .box1{
        width:100%;


        }

    .box2{
        width:100%;


        }

    }

/*Landscape smart phone*/
@media only screen and (min-width: 321px) and (max-width: 480px)and (orientation:landscape){
        /* Styles */
    .box1{
        width:50%;
        float:left;

        }
    .box2{
        width:50%;
        float:left;

        }
    }

/*Portrait smart phone*/
@media only screen and(max-width: 320px)and (orientation:Portrait){

    .box1{
        width:100%;


        }

    .box2{
        width:100%;


        }

    }
</style>
</head>

<body>


  <div class="box1">
  Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
  </div>
  <div class="box2">

  Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
  </div>



</body>
</html>

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

无论内容如何,全屏CSS框架均适用于所有分辨率

来自分类Dev

适用于高分辨率和小屏幕手机的响应式设计

来自分类Dev

适用于Android游戏的分辨率独立的图形

来自分类Dev

适用于Linux的C ++中的屏幕分辨率

来自分类Dev

@Media 查询(最小宽度)CSS 不适用于某些分辨率

来自分类Dev

存储图像以用于所有分辨率

来自分类Dev

60 的刷新率不适用于 4K 分辨率

来自分类Dev

仅适用于移动设备且仅适用于 Woocommerce 单页的全宽非响应式 CSS

来自分类Dev

适用于Surface Pro 3分辨率的WinRT App

来自分类Dev

过载分辨率不适用于操作员过载

来自分类Dev

Android布局-适用于不同屏幕分辨率和相同密度的图像

来自分类Dev

显卡分辨率是否适用于两个输出?

来自分类Dev

Newrez适用于KDE吗?(分辨率下采样)

来自分类Dev

Ubuntu 10.10:获得适用于LCD HDTV的适当显示器分辨率

来自分类Dev

制作适用于多种分辨率的 2 列布局的最佳方法?

来自分类Dev

使网页适合所有分辨率

来自分类Dev

响应式网页设计适用于桌面,但不适用于移动设备,它不会加载 CSS 和 JavaScript

来自分类Dev

适用于iOS8中自定义键盘的iPhone 6 Plus分辨率图像

来自分类Dev

Unity:适用于不同分辨率的多显示器的奇怪相机偏移

来自分类Dev

适用于Android的Google Places API错误:状态{statusCode = NETWORK_ERROR,分辨率=空}

来自分类Dev

适用于iOS8中自定义键盘的iPhone 6 Plus分辨率图像

来自分类Dev

对相同尺寸使用dp不适用于分辨率不同但尺寸相同的不同手机

来自分类Dev

用于导出画板中每个图层的所有与Anroid相关的分辨率的脚本

来自分类Dev

保持所有屏幕分辨率的翻译 css (x,y) 值相同?

来自分类Dev

如何制作适用于Web和移动设备的SVG响应式进度栏?

来自分类Dev

Bootstrap嵌入响应式格式不适用于横向移动浏览器

来自分类Dev

响应式引导程序不适用于 Rails 项目中的移动设备

来自分类Dev

获取所有支持的屏幕分辨率

来自分类Dev

所有分辨率内的Libgdx拟合游戏

Related 相关文章

  1. 1

    无论内容如何,全屏CSS框架均适用于所有分辨率

  2. 2

    适用于高分辨率和小屏幕手机的响应式设计

  3. 3

    适用于Android游戏的分辨率独立的图形

  4. 4

    适用于Linux的C ++中的屏幕分辨率

  5. 5

    @Media 查询(最小宽度)CSS 不适用于某些分辨率

  6. 6

    存储图像以用于所有分辨率

  7. 7

    60 的刷新率不适用于 4K 分辨率

  8. 8

    仅适用于移动设备且仅适用于 Woocommerce 单页的全宽非响应式 CSS

  9. 9

    适用于Surface Pro 3分辨率的WinRT App

  10. 10

    过载分辨率不适用于操作员过载

  11. 11

    Android布局-适用于不同屏幕分辨率和相同密度的图像

  12. 12

    显卡分辨率是否适用于两个输出?

  13. 13

    Newrez适用于KDE吗?(分辨率下采样)

  14. 14

    Ubuntu 10.10:获得适用于LCD HDTV的适当显示器分辨率

  15. 15

    制作适用于多种分辨率的 2 列布局的最佳方法?

  16. 16

    使网页适合所有分辨率

  17. 17

    响应式网页设计适用于桌面,但不适用于移动设备,它不会加载 CSS 和 JavaScript

  18. 18

    适用于iOS8中自定义键盘的iPhone 6 Plus分辨率图像

  19. 19

    Unity:适用于不同分辨率的多显示器的奇怪相机偏移

  20. 20

    适用于Android的Google Places API错误:状态{statusCode = NETWORK_ERROR,分辨率=空}

  21. 21

    适用于iOS8中自定义键盘的iPhone 6 Plus分辨率图像

  22. 22

    对相同尺寸使用dp不适用于分辨率不同但尺寸相同的不同手机

  23. 23

    用于导出画板中每个图层的所有与Anroid相关的分辨率的脚本

  24. 24

    保持所有屏幕分辨率的翻译 css (x,y) 值相同?

  25. 25

    如何制作适用于Web和移动设备的SVG响应式进度栏?

  26. 26

    Bootstrap嵌入响应式格式不适用于横向移动浏览器

  27. 27

    响应式引导程序不适用于 Rails 项目中的移动设备

  28. 28

    获取所有支持的屏幕分辨率

  29. 29

    所有分辨率内的Libgdx拟合游戏

热门标签

归档