简体   繁体   English

我无法在HTML网页中显示CSS框,应该进行哪些更改?

[英]I cannot get a CSS box to show up in my HTML webpage, what changes should I make?

I want the words "Check Out" to show up in a CSS box, however I am not able to do this. 我希望在CSS框中显示“签出”字样,但是我无法做到这一点。 Here is my code: 这是我的代码:

<!DOCTYPE html>
<html lang="en">

<head>
<title>Box</title>
</head>

<style>
.boxed {
    width: 200px;
    padding: 5px;
    border: 5px blue;
    margin: 0;
}

.shadow {
position: relative;
max-width: 270px;
box-shadow: 1px 1px 1px rgba(0,0, 0, 0.2)
}
</style>
<body>
<div class="boxed">Check Out</div>
</body>

  1. The style tags go inside the head tags. 样式标签位于head标签内。

  2. like Brendan mentioned, you were missing the closing html tag. 就像布伦丹(Brendan)提到的那样,您缺少html结束标记。

  3. Also, for the border you just had 另外,对于边境

     .boxed { border: 5px blue; } 

You need to specify which type of border, like is it solid, dotted, dashed? 您需要指定边框的类型,例如边框,点线,虚线吗?

So I added 所以我加了

.boxed { border: 5px solid blue; }

 <!DOCTYPE html> <html lang="en"> <head> <title>Box</title> <style> .boxed { width: 200px; padding: 5px; border: 5px solid blue; margin: 0; } .shadow { position: relative; max-width: 270px; box-shadow: 1px 1px 1px rgba(0,0, 0, 0.2) } </style> </head> <body> <div class="boxed">Check Out</div> </body> </html> 

You need to declare the third part of a border. 您需要声明边框的第三部分。 A border is line thickness(px) color, and type: dashed, solid, transparent and a lot of others. 边框是线条粗细(px)的颜色,其类型为:虚线,实线,透明以及许多其他颜色。 Google it. 谷歌一下。

The div is visible. div是可见的。 the only thing you missed was a background (pretty, pretty) and maybe if you can't see it on screen is because of it's display, position, size, etc. 您唯一错过的是背景(漂亮,漂亮),也许您在屏幕上看不到它是因为它的显示,位置,大小等。

if you want to see it go to http://jsfiddle.net/rgqfjb1v/ 如果您想查看它,请访问http://jsfiddle.net/rgqfjb1v/

also check if you have that last </html> 还要检查您是否最后一个</html>

I also added solid for the border, like this: border: 5px solid blue; 我还为边框添加了实线,如下所示: border: 5px solid blue;

'YOU MISSED THE SOLID OPTION' “您遗漏了固体选项”

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

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