<i id='PXrtX'><tr id='PXrtX'><dt id='PXrtX'><q id='PXrtX'><span id='PXrtX'><b id='PXrtX'><form id='PXrtX'><ins id='PXrtX'></ins><ul id='PXrtX'></ul><sub id='PXrtX'></sub></form><legend id='PXrtX'></legend><bdo id='PXrtX'><pre id='PXrtX'><center id='PXrtX'></center></pre></bdo></b><th id='PXrtX'></th></span></q></dt></tr></i><div id='PXrtX'><tfoot id='PXrtX'></tfoot><dl id='PXrtX'><fieldset id='PXrtX'></fieldset></dl></div>
  • <small id='PXrtX'></small><noframes id='PXrtX'>

      • <bdo id='PXrtX'></bdo><ul id='PXrtX'></ul>

        <legend id='PXrtX'><style id='PXrtX'><dir id='PXrtX'><q id='PXrtX'></q></dir></style></legend>

      1. <tfoot id='PXrtX'></tfoot>

        CSS垂直旋转文本 - 两侧的额外空间

        时间:2023-10-13
      2. <legend id='4rn9u'><style id='4rn9u'><dir id='4rn9u'><q id='4rn9u'></q></dir></style></legend>
            <bdo id='4rn9u'></bdo><ul id='4rn9u'></ul>
              <tbody id='4rn9u'></tbody>

              <tfoot id='4rn9u'></tfoot>
              <i id='4rn9u'><tr id='4rn9u'><dt id='4rn9u'><q id='4rn9u'><span id='4rn9u'><b id='4rn9u'><form id='4rn9u'><ins id='4rn9u'></ins><ul id='4rn9u'></ul><sub id='4rn9u'></sub></form><legend id='4rn9u'></legend><bdo id='4rn9u'><pre id='4rn9u'><center id='4rn9u'></center></pre></bdo></b><th id='4rn9u'></th></span></q></dt></tr></i><div id='4rn9u'><tfoot id='4rn9u'></tfoot><dl id='4rn9u'><fieldset id='4rn9u'></fieldset></dl></div>
            1. <small id='4rn9u'></small><noframes id='4rn9u'>

                • 本文介绍了CSS垂直旋转文本 - 两侧的额外空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  当我使用 TEXT 旋转和内联图层时,它会在旋转时增加额外的空间(大文本的宽度),我不想修复.使用 CSS 旋转时避免两侧多余空间(元素宽度)的最佳方法是什么.

                  When I rotate and inline layer with TEXT, it adds extra space (width of large text) on the rotation, I dont want to fix. What is the best way to avoid extra space (width of element) on both sides when rotating with CSS.

                  以下是我的代码:

                  .rotate {
                    display: inline-block;
                    white-space: nowrap;
                    transform: translate(0, 100%) rotate(-90deg);
                    transform-origin: 0 0;
                    vertical-align: bottom;
                  }
                  
                  .rotate:before {
                    content: "";
                    float: left;
                    margin-top: 100%;
                  }
                  
                  .rotate:after {
                    content: "";
                    display: inline-block;
                  }

                  <div style="display:inline-block; position:relative;" class="rotate">
                    <span style="displock;width:100%;font-size: 55px;color: #222222;opacity: 0.15;white-space: nowrap;">BACKGROUND</span>
                    <span style="display:block;width:100%;font-size: 45px;color: #222222;text-align:center;">TITLE</span>
                  
                  </div>
                  Some randome text here should be close to the rotated element Some randome text here should be close to the rotated element Some randome text here should be close to the rotated element

                  推荐答案

                  您可以尝试使用 写作模式 .

                  You may try to use writing-mode .

                  writing-mode CSS 属性定义文本行是水平还是垂直布局,以及块前进的方向.

                  The writing-mode CSS property defines whether lines of text are laid out horizontally or vertically and the direction in which blocks progress.

                  https://codepen.io/gc-nomade/pen/rGJGzQ?editors=1100

                  .rotate {
                    writing-mode:vertical-rl;
                    transform:scale(-1);
                    width:50px;
                    margin-right:50px;
                  }
                  
                  body {
                    display:flex;
                    align-items:flex-end; 
                  }

                  <div style="display:inline-block; position:relative;" class="rotate">
                    <span style="displock;width:100%;font-size: 55px;color: #222222;opacity: 0.15;white-space: nowrap;">BACKGROUND</span>
                    <span style="display:block;width:100%;font-size: 45px;color: #222222;text-align:center;">TITLE</span>
                  
                  </div>
                  Some randome text here should be close to the rotated element Some randome text here should be close to the rotated element Some randome text here should be close to the rotated element

                  transform:rotate(-90deg) (这是您的首选),但使用伪来根据文本长度重置高度.(这需要使用 rgba() 颜色并将两行文本设置在一个容器中.https://codepen.io/gc-nomade/pen/RLQLJG?editors=1100

                  or transform:rotate(-90deg) (which was your first choice), but with a pseudo to reset height according to text-length. (this requires to use rgba() colors and set both line of text in a single container. https://codepen.io/gc-nomade/pen/RLQLJG?editors=1100

                  .rotate {
                    width:110px;
                  }
                  .rotate>span   {
                    display:inline-block; 
                    transform:rotate(-90deg)
                  }
                  .rotate > span:before {
                    content:'';
                    padding-top:100%;
                    float:left;
                  }
                  
                  body {
                    display:flex;
                    align-items:flex-end;
                    justify-content:flex-start;
                  }

                  			<div style="display:inline-block; position:relative;" class="rotate">
                  				<span style=" font-size: 55px;color: rgba(0,0,0,0.15);white-space: nowrap;">BACKGROUND<br/>
                  				<span style="display:block;font-size: 45px;color: #222222;text-align:center;">TITLE</span></span>				
                  			</div>
                        Some randome text here should be close to the rotated element Some randome text here should be close to the rotated element Some randome text here should be close to the rotated element

                  两种技术需要为旋转文本容器设置宽度,并且是从弹性容器构建的.它应该可以在 IE、FF、Chrome 中运行.(display:table/table-cell 可以是旧浏览器的另一个 display 选项)

                  Both technics here, requires to set a width to the rotating text container and are build from a flex container. It should work in IE,FF,Chrome. (display:table/table-cell can be another display option for older browser)

                  这篇关于CSS垂直旋转文本 - 两侧的额外空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Safari CSS Bug:动画旋转方向不正确? 下一篇:文件 URL “不允许加载本地资源"在 Internet 浏

                  相关文章

                  最新文章

                    <small id='Qc9rq'></small><noframes id='Qc9rq'>

                      <bdo id='Qc9rq'></bdo><ul id='Qc9rq'></ul>
                  1. <legend id='Qc9rq'><style id='Qc9rq'><dir id='Qc9rq'><q id='Qc9rq'></q></dir></style></legend>

                    1. <i id='Qc9rq'><tr id='Qc9rq'><dt id='Qc9rq'><q id='Qc9rq'><span id='Qc9rq'><b id='Qc9rq'><form id='Qc9rq'><ins id='Qc9rq'></ins><ul id='Qc9rq'></ul><sub id='Qc9rq'></sub></form><legend id='Qc9rq'></legend><bdo id='Qc9rq'><pre id='Qc9rq'><center id='Qc9rq'></center></pre></bdo></b><th id='Qc9rq'></th></span></q></dt></tr></i><div id='Qc9rq'><tfoot id='Qc9rq'></tfoot><dl id='Qc9rq'><fieldset id='Qc9rq'></fieldset></dl></div>

                      <tfoot id='Qc9rq'></tfoot>