dongwubao4785 2019-04-16 18:09
浏览 145

在核心php项目中动态LTR到RTL

I have a website written in core php , I want to add Arabic language . So i have to make LTR to RTL dynamically . But how can I do it ? do i have to change all css code and rewrtie them all for RTL or is there anythins else ? I searched a lot and found rtlcss but how can i implement them easily ?

  • 写回答

2条回答

  • donjao6770 2019-04-16 18:39
    关注

    all of the following code is pure examples and will be shortened

    index.html

    <html>
        <head>
            <link rel="stylesheet" type="text/css" href="/css/main.min.css">
            <!-- this should be included if the user's language is RTL -->
            <link rel="stylesheet" type="text/css" href="/css/rtl.min.css">
        </head>
        <body></body>
    </html>
    

    main.min.css

    /* here goes all css codes that goes with all pages */
    body {
      padding-top: 50px;
    }
    div.tab-content {
      padding-top: 20px;
    }
    .main-panel {
        float: right;
    }
    

    rtl.min.css

    /* this will override the previous css rule */
    .main-panel {
        float: left;
    }
    body {
        direction: rtl;
        margin: 0;
    }
    

    you can also join them together in one file and in your php file add class to body .rtl and in your css file ( of course at the end ) add css rules like:

    body.rtl {
        direction: rtl;
    }
    

    but for sake of lighter css files and since many users will not benefit from the RTL rules i would advise using the first example

    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料