如何划分标题和主要标签?

霍西托

我刚刚创建了一个标题,在主要部分之后,我的主要部分在标题中,我试图从顶部开始,但对我不起作用。我制作了一个屏幕来显示我的问题:这就是它的样子我需要将标题和主要内容分开,例如主要内容。带有页眉顶部的边距。我也将两者都设置为块显示,不起作用。不应该使用主标签或切换到 div 元素?有我的html代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Microsoft Windows</title>

    <link rel="stylesheet" href="css/style.css">
    <link rel="icon" type="image/png" href="favicon/microsoft32.png">
</head>
<body>
    <header>
        <ul id="header-left">
            <li><a href="#">Microsoft Windows</a></li>
        </ul>
        <ul id="header-right">
            <li><a href="#">Explore Windows 11</a></li>
            <li><a href="#">Shop devices</a></li>
            <li><a href="#">Download</a></li>
        </ul>
    </header>
    <main>
        <div id="hero">
            <div id="hero-text">
                <h2>Made for you, designed for all</h2>
            </div>
        </div>
    </main>
</body>
</html>

和我的CSS:

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200&family=Source+Sans+Pro:wght@300;400&display=swap');

* {
    padding: 0px;
    margin: 0px;
    box-sizing: border-box;
}

a {
    text-decoration: none;
}

body {
    width: 70%;
    margin: auto;
}

header {
    margin-top: 5%;
    display: block;
}

header ul {
    width: fit-content;
}

header #header-left {
    float: left;
    font-family: 'Poppins', sans-serif;
}

header #header-right {
    float: right;
    font-family: 'Source Sans Pro', sans-serif;
}

header #header-right li {
    margin-right: 25px;
}

header #header-right li:last-child {
    margin-right: 0px;
}

header ul li {
    display: inline-block;
    font-size: 22px;
    font-weight: 600;
    text-transform: uppercase;
}

header #header-right li::after {
    display:block;
    content: '';
    border-bottom: solid 2px black;
    transform: scaleX(0);
    transition: transform 250ms ease-in-out;
}

header #header-right li:hover:after { transform: scaleX(1); }

header #header-right li::after {
    transform-origin: 0% 50%;
}

header ul li a {
    color: black;
}

main {
    display: block;
}

莫妮卡·维尔玛尼
try this it will help you

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200&family=Source+Sans+Pro:wght@300;400&display=swap');

* {
    padding: 0px;
    margin: 0px;
    box-sizing: border-box;
}

a {
    text-decoration: none;
}

body {
    width:100%;
    margin: 0;
}
.conatiner{
margin:auto;
max-width:1200px;
width:100%;
}
header {
float:left;
width:100%;

}
.navbar{
float:left;
width:100%;
padding:10px;
background:#eee;
}
header ul {
    width: fit-content;
}

header #header-left {
    float: left;
    font-family: 'Poppins', sans-serif;
}
.navbrand{
line-height:35px;
}
header #header-right {
    float: right;
    font-family: 'Source Sans Pro', sans-serif;
}

header #header-right li {
  padding:10px;
  font-size:14px;
}

header #header-right li:last-child {
    margin-right: 0px;
}

header ul li {
    display: inline-block;
    font-size: 22px;
    font-weight: 600;
    text-transform: uppercase;
}

header #header-right li::after {
    display:block;
    content: '';
    border-bottom: solid 2px black;
    transform: scaleX(0);
    transition: transform 250ms ease-in-out;
}

header #header-right li:hover:after { transform: scaleX(1); }

header #header-right li::after {
    transform-origin: 0% 50%;
}

header ul li a {
    color: black;
}

main {
float:left;
width:100%;

}
#hero{float:left;
width:100%;
padding:1em;
text-align:center;
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Microsoft Windows</title>

    <link rel="stylesheet" href="css/style.css">
    <link rel="icon" type="image/png" href="favicon/microsoft32.png">
</head>
<body>

    <header>
    <section class="navbar">
           <section class="conatiner">
          <a href="#" class="navbrand">Microsoft Windows</a>
      
        <ul id="header-right">
            <li><a href="#">Explore Windows 11</a></li>
            <li><a href="#">Shop devices</a></li>
            <li><a href="#">Download</a></li>
        </ul>
          </section>
        </section>
    </header>
    <section class="conatiner">
    <main>
        <div id="hero">
            <div id="hero-text">
                <h2>Made for you, designed for all</h2>
            </div>
        </div>
    </main>
    </section>
</body>
</html>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何删除android活动标签(活动标题)和标签栏?

在Matplotlib中划分x和y标签

如何使用.plot()设置figsize,标签和标题

如何在 gnuplot 中使标签和标题加粗?

如何从该元素标签获取价格,标题和链接?

如何居中对齐div标签中包含的标题和图像

如何获取Blogspot中标签的标题和描述值?

如何重命名seaborn散点图图例中的标签和标题?

如何清除标签标题?

如何使div正确对齐以开始页面布局?(标题,左面板和主要部分)

在拼凑而成的主要标题和剧情标题之间添加图例

如何在CNN上获取主要标题?

标签和标题之间的间距

Matplotlib BoxPlot标签和标题

NDVA和网页标题标签

如何删除SwiftUI中主要内容视图和标签栏之间的间距?

Angular ngFor 和将表格划分为标题部分

如何使用Selenium和Python提取https://tengrinews.kz中7个主要新闻的时间和标题

在matplotlib中使用.subplot时如何添加标题,x轴标签和y轴标签?

如何更改标签标题框的大小和ttk笔记本标签的字体?

如何以可以将它们用作机器学习功能的方式来分割或划分我的图像和标签?

如何从SPAN标签打印标题

如何使x和y轴标签的文本大小以及matplotlib和prettyplotlib图上的标题变大

划分不同的标题级别

划分列标题

我有一个记事本,每个笔记都有一个标题和主要内容。单击标题时如何使内容出现/消失?

如何让python添加和划分多个变量?

如何使用循环将colnames作为主要标题

Laravel搜索标题和相关标签