简体   繁体   English

css 代码不能正常工作

[英]css code is not working properly

This is the first time writing a css file from myself.这是我第一次写自己的css文件。

Everything is working fine, but i have a problem with my menu/content width.一切正常,但我的菜单/内容宽度有问题。 I'm working with percentage to fill the whole screen.我正在使用百分比来填充整个屏幕。 There is some blank space left, and when i adjust my browser width, its totally broken (menu/content).剩下一些空白,当我调整浏览器宽度时,它完全坏了(菜单/内容)。

Code:代码:

header {
background-color: black;
color: white;
text-align: center;
width: 100%;
height: 20%;
margin: 0px;
padding: 10px;
}

menu {
background-color: gray;
color: white;
height: 60%;
width: 10%;
float: left;
margin: 0px;
padding: 10px;
}

content {
background-color: blue;
float: left;
color: white;
width: 87%;
height: 60%;
margin: 0px;
padding: 10px;
}

footer {
clear: both;
background-color: black;
color: white;
width: 100%;
height: 20%;
margin: 0px;
padding: 10px;
}

This is my testing URL: Testing url这是我的测试网址:测试网址

I think this is what you're aiming for.我想这就是你的目标。

body {
  margin:0;
}

header {
  background-color: black;
  color: white;
  text-align: center;
  width: 100%;
  height: 20%;
  margin: 0px;
}

menu {
  background-color: gray;
  color: white;
  height: 60%;
  width: 10%;
  float: left;
  margin: 0px;
  -webkit-padding-start: 0px;
}

content {
  background-color: blue;
  float: left;
  color: white;
  width: 90%;
  height: 60%;
  margin: 0px;
}

footer {
  clear: both;
  background-color: black;
  color: white;
  width: 100%;
  height: 20%;
  margin: 0px;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM