1

这是我的网站: http ://smartpeopletalkfast.co.uk/4/test

我用 CSS 旋转文本。我希望文本位于图像的左侧:

在此处输入图像描述

注意,我目前只为 css 添加了 webkit 前缀。所以这是我粗略的 div 结构和 CSS。

<div>
 <img src="whatever.jpg" />
 <p>Here is some text</p>
</div>

p {
                margin: 0;
                text-align: center;
                -webkit-transform: rotate(-90deg);
            }
4

2 回答 2

1
 *{
    padding:0;
    margin:0;
    -webkit-box-sizing: border-box; 
    -moz-box-sizing: border-box;    
    box-sizing: border-box;       
}
figure{
    position:relative;
    left: 100px;
    top: 100px;
    width:200px;
    height:200px;
    border:4px solid #ccc;
}

img{
    width:100%;
    height:100%;
    position:absolute;
    left:0;
    top:0;
}
figcaption {
 text-align: center;
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg); 
transform: rotate(-90deg); 
position: absolute;
left: -100px;
top: 60px;
width: 150px;
height: 20px;
 }

标记

<figure>
    <img src="http://www.disney.co.uk/brave/common/images/characters/merida.png" />
    <figcaption>Here is some text</figcaption>
</figure>

演示:http: //jsfiddle.net/NeeXm/

于 2013-08-19T00:26:32.337 回答
0

您可以设置positionabsolute. 之后使用lefttop值将其带到左侧中间位置。

于 2013-08-18T12:57:02.317 回答