简体   繁体   English

transform-origin属性对不同的文本大小有不同的作用

[英]transform-origin property working differently on different text sizes

I am working on a webpage design. 我正在从事网页设计。 There I have to direct the text upright. 在那里,我必须将文本直立放置。 I am doing it via transform rotate and setting the origin. 我通过变换旋转和设置原点来实现。 However, the text on the side of each square positions differently specially on the right side. 但是,每个正方形侧面的文字在右侧的位置特别不同。 if the text characters are more or less the transform origin property works differently and the text on the side of the square goes to far or goes in. I have no idea what is going on. 如果文本字符或多或少有一些变化,则transform origin属性的工作方式有所不同,并且正方形侧面的文本变远了或进入了。我不知道发生了什么。 This is the fiddle . 这是小提琴 I can't paste the code here that would be too messy and lengthy here. 我不能在这里粘贴太长且冗长的代码。

.right-vertical-text{
  transform: rotate(90deg);
  transform-origin: 65px 85px;
  margin:15px;
  right: 0px;
}

the transform-origin here does not work consistently for all the side headers. 此处的transform-origin不适用于所有侧面标头。 for example the side header header is positioned very far from the square. 例如,侧面标headerheader的位置离正方形很远。

Should replace the css 应该更换css

.right-vertical-text {
    transform: rotate(90deg);
    transform-origin: 65px 85px;
    margin: 15px;
    right: 0px;
    width: 135px; /*Added*/
}

For some reason the position of h2 is depends upon the width of its parent 由于某些原因, h2的位置取决于其父级的width

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM