zoukankan      html  css  js  c++  java
  • 非换行空白:non-breaking space

    一 维基百科(英文版)词条

     

    In word processing and digital typesetting, a non-breaking space (" ") (also called no-break space, non-breakable space (NBSP), hard space, or fixed space) is a space character that prevents an automatic line break at its position. In some formats, including HTML, it also prevents consecutive whitespace characters from collapsing into a single space.

     

    In HTML, the common non-breaking space, which is the same width as the ordinary space character, is encoded as   or  . In Unicode, it is encoded as U+00A0.

     

    1  不可中断空白连同前面一个、后面一个字符都在同一行,不会换行。

    2 多个不可中断空白不会被视为一个字符

    3 不可中断字符,在js中是xA0,在html中是 

     

    二 代码

     

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="UTF-8">
            <title></title>
            <style type="text/css">
                *{
                    margin:10px 0 0 0;
                    padding:0;
                }
                .box{
                    width:50px;
                    height:50px;
                    background:grey;
                    font-size: 16px;
                }
            </style>
        </head>
        <body style="padding:0 50px;">
            <div class="box" id="box01">
                
            </div>
            <div class="box" id="box02">
                
            </div>
            <script>
                var str01 = '奥路xA0xA0xA0xA0xA0xA0xA0xA0菲';
                document.getElementById('box01').innerHTML = str01;
                var str02 = '奥路&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;菲';
                document.getElementById('box02').innerHTML = str02;
            </script>
        </body>
    </html>

    三 页面效果

  • 相关阅读:
    通过scp拷贝文件时无需交互输入密码
    suse linux安装lrzsz
    shc加密shell脚本
    linux小程序--cmatrix
    linux系统PXE+Kickstart自动安装系统
    升级SSH
    shell生成随机数的几种方法
    django —— MVT模型
    Django学习---笔记一
    python学习--Django虚拟环境搭建
  • 原文地址:https://www.cnblogs.com/sea-breeze/p/7285558.html
Copyright © 2011-2022 走看看