<!DOCTYPE html><html><head> ? ?<meta charset="UTF-8"> ? ?<title>設置背景漸變</title> ? ?<style type="text/css"> ? ? ? ?.big{ ? ? ? ? ? ?width: 300px; ? ? ? ? ? ?height: 300px; ? ? ? ? ? ?background-color: red; ? ? ? ? ? ?margin-top:100px; ? ? ? ? ? ?float: left; ? ? ? ?} ? ? ? ?.small{ ? ? ? ? ? ?width: 100px; ? ? ? ? ? ?height: 100px; ? ? ? ? ? ?background-color: blue; ? ? ? ? ? ?margin-top:10px; ? ? ? ?} ? ?</style></head><body><div class="big"> ? ?<div class="small"></div></div></body></html>
為什么big添加浮動后,small中margin-top是相對于big的,而不是body的
Efficiency90
2017-03-11 14:42:38