标题和段落文本在同一行

时间:2021-04-12 13:26:09

标签: html css

我目前正在尝试在 freecodecamp 上完成个人作品集网页任务,但遇到了障碍。

我的标题和段落文本按照我的意愿在页面中间对齐,但是,段落文本似乎忽略了该元素。

我曾尝试插入断线但无济于事,在我继续完成挑战之前,我真的很感激这方面的帮助。

body {
  background-color: #0d3d95;
}

.welcome-section {
  display: flex;
  flex-diection: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100vh;
}

#projects {}

h1 {
  font-family: monospace;
  font-size: 16px;
  color: white;
  text-align: center;
}

p {
  font-size: 20px;
  color: white;
}

#navbar {}

a {
  color: white;
  text-decoration: none;
  font-family: helvetica;
}

ol {
  display: inline;
}

.nav {
  display: flex;
  justify-content: flex-end;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: #8524e9;
  border-bottom: 5px solid #042574;
}
<!--nav section-->
<nav id="navbar" class="nav">
  <ul>
    <ol> <a href="#">About<a/></ol>
    <ol> <a href="#">Contact<a/></ol>
    <ol> <a href="#">Projects<a/></ol>
</ul>
    </nav> 
<!--End nav section-->
    
<!--Welcome  Section Start-->
<section id="welcome-section" class="welcome-section">
  <h1>Hey I am Mimic</h1>
  <p>a web developer</p>
</section>
<!--Welcome  Section End-->
<section id="projects">
 
</section>

2 个答案:

答案 0 :(得分:0)

class Node: def __init__(self, data, left=None, right=None): self.data = data self.left = left self.right = right def inorderTraversal(root): if root is None: return inorderTraversal(root.left) print(root.data, end=' ') inorderTraversal(root.right) def preorderTraversal(root): if root is None: return print(root.data, end=' ') preorderTraversal(root.left) preorderTraversal(root.right) def construct(start, end, preorder, pIndex, dict): # base case if start > end: return None, pIndex root = Node(preorder[pIndex]) pIndex = pIndex + 1 index = dict[root.data] root.left, pIndex = construct(start, index - 1, preorder, pIndex, dict) root.right, pIndex = construct(index + 1, end, preorder, pIndex, dict) return root, pIndex def constructTree(inorder, preorder): dict = {} for i, e in enumerate(inorder): dict[e] = i pIndex = 0 return construct(0, len(inorder) - 1, preorder, pIndex, dict)[0] if __name__ == '__main__': inorder = [4, 2, 1, 7, 5, 8, 3, 6] preorder = [1, 2, 4, 3, 5, 7, 8, 6] root = constructTree(inorder, preorder) print("The inorder traversal is ", end='') inorderTraversal(root) preorderTraversal(root) 中的 flex-direction: column; 有拼写错误。你写了.welcome-section

flex-diection: column;
body {
  background-color: #0d3d95;
}

.welcome-section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100vh;
}

#projects {}

h1 {
  font-family: monospace;
  font-size: 16px;
  color: white;
  text-align: center;
}

p {
  font-size: 20px;
  color: white;
}

#navbar {}

a {
  color: white;
  text-decoration: none;
  font-family: helvetica;
}

ol {
  display: inline;
}

.nav {
  display: flex;
  justify-content: flex-end;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: #8524e9;
  border-bottom: 5px solid #042574;
}

答案 1 :(得分:-1)

welcome-section中应该有flex-direction: column;,你拼错了