css属性练习

1.justify-content:flex-start|flex-end|center|space-between|space-around|space-evenly|initial|inherit;都是水平方向布局。

flex-start  flex-end(在最右侧显示)  center(在浏览器中间显示)

 space-around:

space-between:

space-evenly:空格均衡分布

initial: 最开始的

 

 inherit:继承,与initial和flex-start效果一样。

2.align-items: stretch|center|flex-start|flex-end|baseline|initial|inherit;垂直方向的对齐方式。

stretch:与flex-start  baseline(基础,起点)initial|inherit效果一样

3.display:

display后编码不设置属性:

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>块级元素</title>
	<style>
		.red{
			width: 200px;
			height: 100px;
            background:#EE5A24;
            border: 1px solid;
            /*display:block;*/
        }
        .green{
        	width:200px;
        	height: 100px;
        	border: 1px solid;
            background:#009432;
            /*display:block;*/
        }
        .blue{
        	width: 200px;
        	height: 100px;
        	border: 1px solid;
            background:#0652DD;
            /*display:block;*/
        }

	</style>
</head>
<body>
	<div class="red">
	</div>
	<div class="green">
	
	</div>
	<div class="blue">
	</div>
</body>
</html>

效果如下:属于流式布局。

设置为None时: 

.red{
			width: 200px;
			height: 100px;
            background:#EE5A24;
            border: 1px solid;
            display:none;
        }

效果如下:红色盒子被隐藏,不显示。

 设置为:inline

.red{
			width: 200px;
			height: 100px;
            background:#EE5A24;
            border: 1px solid;
            display:inline;
        }

效果如下:

 设置为:inline-block

<style>
		.red{
			width: 200px;
			height: 100px;
            background:#EE5A24;
            border: 1px solid;
            display:inline-block;
        }
        .green{
        	width:200px;
        	height: 100px;
        	border: 1px solid;
            background:#009432;
            display:inline-block;
        }
        .blue{
        	width: 200px;
        	height: 100px;
        	border: 1px solid;
            background:#0652DD;
            display:inline-block;
        }

效果如下:

设置为:list-item:该元素以列表形式显示

<style>
		.red{
			width: 200px;
			height: 100px;
            background:#EE5A24;
            border: 1px solid;
            display:list-item;
        }
        .green{
        	width:200px;
        	height: 100px;
        	border: 1px solid;
            background:#009432;
            display:list-item;
        }
        .blue{
        	width: 200px;
        	height: 100px;
        	border: 1px solid;
            background:#0652DD;
            display:list-item;
        }

显示效果如下:

 设置为:run-in

<style>
		.red{
			width: 200px;
			height: 100px;
            background:#EE5A24;
            border: 1px solid;
            display:run-in;
        }
</style>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dhl383561030

您的鼓励是我前进的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值