html5 - html,为什么右边框会被挡住?

查看:117
本文介绍了html5 - html,为什么右边框会被挡住?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

我用这样的样式描绘,为什么container块的右边框会被挡住呢?请达人指教,感谢。

‘’‘html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" type="text/css" href="almanac.css">
<title>Almanac</title>
<style type="text/css">
.container {border:10px solid #000;width:100%; float: left;}
.year {margin-top: 10px;border-top: 1px solid #000;padding: 10px}
.week {float: right;}
.date {padding-top: 10px;border-top: 1px solid #000;font-size: 150px;text-align:center;}
.today {padding-bottom: 10px;text-align: center;font-size:50px}
.example {padding: 10px;border-top: 1px solid #000;text-align: justify;}
.author {float: right; padding: 10px;font-size: 12px}

</style>
</head>
<body>

<div class="container">

<div class="year"> <span>May 12th, 2016</span> <span class="week">Thursday</span></div>
<div class="date">12</div>
<div class="today">oath</div>
<div class="example"> He swore an oath promising to uphold and protect the country's laws and constitution. </div>
<div class="author">WeChat:xxx</div>

</div>
</body>
</html>

'''

解决方案

下面有个滚动条嘛,你拉到右边去就看到啦。
你的宽度设置太大把整个页面都撑宽了。
给你的container加个box-sizing:border-box;

这篇关于html5 - html,为什么右边框会被挡住?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆