【问题标题】:Div Tags and a headerdiv 标签和标题
【发布时间】:2016-03-22 19:17:43
【问题描述】:

大家好,我目前正在尝试制作一个网站,我已经制定了设计,并开始尝试使用几个 div 标签、徽标图像、底部边框和按钮制作标题。 这是我对我尝试做的事情的基本概述:(对不起,它模糊但可用)

这是当前结果,它看起来很糟糕。

Finnaly 这是负责的代码,任何人都可以看到我在哪里搞砸了吗?该行应覆盖从徽标到右侧的大部分页面,因此它必须是 div 容器

<html>
<head>

    <style>
    body{ background-image: url("wood texture.jpg");
    }
    .header{
            position:relative;
            width:100%;
            height:10%;
            <!--border-style:solid;
        border-color:black;
        border-width:0px 0px 10px 0px;-->

        }

        .headlogo{
        width:25%;
        height:100%;
        position: absolute;
        padding 0;
        margin:0;
        }
        .headline{
        width:100%;
        height:100%;
        margin:0px 0px 0px 60%;
        <!--padding:0px 0px 0px 25%;
        position: relative;
        left:25%;
        top:0px;-->
        float: right;
        border-style:solid;
        border-color:black;
        border-width:0px 0px 10px 0px;
        }



    </style>
</head>
<body>
<div id="" class="header">


    <div id="" class="headlogo">
     <img src="logo.png" alt="" style="width:25%; height:50%; margin-right:10px; float:right;"
    </div>

    <div id="" class="headline">
    Buttons will go in here and look supper cool but first this needs to stretch all the way to the right from about where the logo stops
    </div>
</div>
</body>
</html>

【问题讨论】:

  • 您在 IMG 标签上缺少`/>`
  • 你应该用 /* comment */ 来评论 css 而不是 。最后一个仅用于html标签。
  • @AlonEitan 谢谢

标签: html css containers


【解决方案1】:

您只是为您的 css 使用了错误的行 cmets。

HTML 是 &lt;!-- something here --&gt;

CSS 是/* something here */

正如 cmets 中所述,您没有使用 /&gt; 关闭您的图像

见小提琴:https://jsfiddle.net/DIRTY_SMITH/7oe5kh9L/50/

既然您在 cmets 中询问过,我将在此处添加 .html 文件中的 css 行 cmets 在使用 notepad++ 时似乎不会被注释掉,要对其进行测试,请尝试使用 css 行cmets 使用 notepad++ 在.css 文件中,您会发现它确实有效。我创建这个小提琴是为了向您展示/* */ 实际上是在&lt;style&gt; 标签内时正确的行cmets。 https://jsfiddle.net/DIRTY_SMITH/7oe5kh9L/52/

毕竟如果还有问题你可以看这个小剪辑:http://docs.emmet.io/actions/toggle-comment/

body{ background-image: url("wood texture.jpg");
    }
    .header{
            position:relative;
            width:100%;
            height:10%;
            /*border-style:solid;
        border-color:black;
        border-width:0px 0px 10px 0px;*/

        }

        .headlogo{
        width:25%;
        height:100%;
        position: absolute;
        padding 0;
        margin:0;
        }
        .headline{
        width:100%;
        height:100%;
        margin:0px 0px 0px 60%;
        /*padding:0px 0px 0px 25%;
        position: relative;
        left:25%;
        top:0px;*/
        float: right;
        border-style:solid;
        border-color:black;
        border-width:0px 0px 10px 0px;
        }

【讨论】:

  • 在记事本++ 工作和/* */ 我不会尝试改变它
  • @plook 它似乎不起作用,因为您在 .html 文件中有 css,但是如果您相信我的话并尝试它,您会发现它确实有效。为了证明我的观点,创建一个.css 文件,然后尝试使用/**/ 注释掉你的css,你会看到它然后改变线条颜色。
  • @plook 查看这个小提琴的例子jsfiddle.net/DIRTY_SMITH/7oe5kh9L/52
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2023-03-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-14
相关资源
最近更新 更多