css3 解决 内联元素 无法使用rotate()方法的问题 (如何让块级元素显示在同一行上)

文档:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js">
</script>
	<style>
		span{
			display:inline;
			width: 400px;
			height: 200px;
			background-color: lightgrey;
		}
		
		.flex-container {
			display: -webkit-flex;
			display: flex;
			width: 400px;
			height: 250px;
			background-color: lightgrey;
		}

		.flex-item {
			background-color: cornflowerblue;
			width: 100px;
			height: 100px;
			margin: 10px;
			transition: 1s;
		}

		
		.drop_down_li_decoration_down{
			transform:rotate(90deg);
			-ms-transform:rotate(90deg); /* IE 9 */
			-webkit-transform:rotate(90deg); /* Safari and Chrome */
			transition: transform 1s;
		}
	</style>
</head>
 
<body>

	<span>
		<a style="background-color: #000; color:#FFA500">行内链接</a>
		<a style="background-color: #000; color:#FFA500; 
				  padding:0 5px;  text-decoration:none;" 
		   href="javascript:void(0);" 
		   οnclick=" $(this).addClass('drop_down_li_decoration_down');"
		   >
			↻
		</a>
		<div class="flex-container" >
			<div class="flex-item"  
				 οnclick=" $(this).addClass('drop_down_li_decoration_down');">flex item 1</div>
			<div class="flex-item"  
				 οnclick=" $(this).addClass('drop_down_li_decoration_down');">flex item 2</div>
			<div class="flex-item" 
				 οnclick=" $(this).addClass('drop_down_li_decoration_down');">flex item 3</div>  
		</div>
	</span>
	

</body>
</html>

问题:


方案:

父级元素使用 display:flex ;

修改后的文档:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js">
</script>
<script> 

	
</script> 
	
	<style>
		span{
			display:inline;
			width: 500px;
			height: 200px;
			background-color: lightgrey;
		}
		
		.flex-container {
			display: -webkit-flex;
			display: flex;
			width: 350px;
			height:150px;
			background-color: lightgrey;
		}

		.flex-item {
			background-color: cornflowerblue;
			width: 100px;
			height: 100px;
			margin: 10px;
			transition: 1s;
		}

		
		.drop_down_li_decoration_down{
			transform:rotate(90deg);
			-ms-transform:rotate(90deg); /* IE 9 */
			-webkit-transform:rotate(90deg); /* Safari and Chrome */
			transition: transform 1s;
		}
	</style>
</head>
 
<body>
	<span style="display: flex;" >
		<a style="background-color: #000; color:#FFA500; 
				  padding:0 20px; margin-bottom:178px;">行内链接</a>
		<a style="background-color: #000; color:#FFA500; margin-left:3px;
				  padding:0 5px;  text-decoration:none; margin-bottom:178px;" 
		   href="javascript:void(0);" 
		   οnclick=" $(this).addClass('drop_down_li_decoration_down');"
		   >
			↻
		</a>
		<div class="flex-container" >
			<div class="flex-item"  
				 οnclick=" $(this).addClass('drop_down_li_decoration_down');">flex item 1</div>
			<div class="flex-item"  
				 οnclick=" $(this).addClass('drop_down_li_decoration_down');">flex item 2</div>
			<div class="flex-item" 
				 οnclick=" $(this).addClass('drop_down_li_decoration_down');">flex item 3</div>  
		</div>
	</span>
	
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值