这是我的第一篇文章,我开始尝试网页设计,所以我从这里拿了一个模板:
http://www.onextrapixel.com/2013/06/24/creating-a-swipeable-side-menu-for-the-web/
我正在尝试更改CSS中的边距。无论我尝试什么,我似乎无法随心所欲。我有下面列出的代码。
编辑:我想让p标签在右边15px移动。我也有Jsfiddle链接。我也为没有加载的图像道歉。这个网站不是我在高中的课堂上做的。编辑2:我现在就开始工作了。
https://jsfiddle.net/zbd9Lvph/
body, html {
height: 100%;
margin: 0;
overflow-x:hidden;
overflow-y:scroll;
font-family: helvetica, Times;
font-weight: 100;
}
.container {
position: relative;
height: 100%;
width: 100%;
left: 0;
-webkit-transition: left 0.3s ease-in-out;
-moz-transition: left 0.3s ease-in-out;
-ms-transition: left 0.3s ease-in-out;
-o-transition: left 0.3s ease-in-out;
transition: left 0.3s ease-in-out;
}
.container.open-sidebar {
left: 240px;
}
#sidebar {
position: absolute;
left: -240px;
background: #007A00;
width: 240px;
height: 100%;
box-sizing: border-box;
}
#sidebar ul {
margin: 0;
padding: 0;
list-style: none;
}
#sidebar ul li {
margin: 0;
}
#sidebar ul li a {
padding: 15px 20px;
font-size: 16px;
font-weight: 100;
color: white;
text-decoration: none;
display: block;
border-bottom: 1px solid #005500;
-webkit-transition: background 0.3s ease-in-out;
-moz-transition: background 0.3s ease-in-out;
-ms-transition: background 0.3s ease-in-out;
-o-transition: background 0.3s ease-in-out;
transition: background 0.3s ease-in-out;
}
#sidebar ul li:hover a {
background: #00CC00;
}
.main-content {
width: 100%;
height: 100%;
padding: 10px;
box-sizing: border-box;
-moz-box-sizing: border-box;
position: relative;
}
.main-content .content{
box-sizing: border-box;
-moz-box-sizing: border-box;
padding-left: 60px;
width: 100%;
float: left;
margin-right:15px;
}
.main-content .content h1{
font-weight: 700;
}
.main-content .content p{
width: 100%;
line-height: 160%;
margin-right:10px;
}
.main-content #sidebar-toggle {
background: #007A00;
border-radius: 3px;
display: block;
position: relative;
padding: 10px 7px;
float: left;
}
.main-content #sidebar-toggle .bar{
display: block;
width: 18px;
margin-bottom: 3px;
height: 2px;
background-color: #fff;
border-radius: 1px;
}
.main-content #sidebar-toggle .bar:last-child{
margin-bottom: 0;
}
.center{
text-align: center;
}
#ctext{
position: fixed;
bottom: 25px;
right: 25px;
}
如果有人可以帮助我,我将不胜感激。仍然是相当新的游戏,所以我想弄清楚。
答案 0 :(得分:0)
尝试在这些元素上添加display: inline-block;
(不起作用)