Home >Web Front-end >HTML Tutorial >Why float:left; has no effect_html/css_WEB-ITnose
I just started learning html today, but float:left; has no effect. I don’t know where I went wrong.
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>css--4</title></head><style type="text/css">div.a{ background:##CCFFFF; width:100px; height:25px; border:5px 15px solid #CCFFCC; margin:1px 2px; text-align:center; color:#999999; font-size:15px; line-height:22px; font-weight:bold; float:left; } div.b{ background:#CCFFFF; width:1100px; height:25px; border:5px solid #CCFFCC; margin:1px 2px; }</style><body><div class="a">首页</div><div class="b"></div></body></html>
Browser-based
width:1100px; Don’t want this
width:1100px; Don’t want this
width:1100px; This is not necessary
width:1100px; You don’t want this