首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我正在尝试在css中并排放置5个标题?

我正在尝试在css中并排放置5个标题?
EN

Stack Overflow用户
提问于 2021-05-26 22:41:41
回答 1查看 22关注 0票数 0

我正在尝试将列表标题并排放到我的网站中,我已经尝试过使用浮动: left和margin right: 32px;代码,但不知何故它仍然不起作用。我是一个新手,所以我目前在互联网上寻找答案。有人能给我提供并排放置标题的代码吗?

代码语言:javascript
复制
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width:device-width, initial-scale=1.0"
  <title>Fitness Website </title>
  <link rel="stylesheet" href="appoooo.css">
</head>
<body style="background-color: silver;">
  <section>
    <header>
      <a href="#" class="logo">Fitness</a>
      <ul class="navigation">
        <li><a class="navigation" href="#">Home</a></li>
        <li><a class="navigation1" href="#">Online Business</a></li>
        <li><a class="navigation2" href="#">Training</a></li>
        <li><a class="navigation3" href="#">Hobbies Vlog</a></li>
        <li><a class="navigation4" href="#">Music</a></li>
      </ul>
    </header>
  </section>


</body>

</html>
代码语言:javascript
复制
    height: 3px;
    margin: 0 2px 0 0;
    position: relative;
}

.navigation1  {
    float: left;
    width: 143px;
    height: 3px;
    margin: 0 2px 0 0;
    position: relative;
}

.navigation2  {
    float: left;
    width: 143px;
    height: 3px;
    margin: 0 2px 0 0;
    position: relative;
}


.navigation3 {
    float: left;
    width: 143px;
    height: 3px;
    margin: 0 2px 0 0;
    position: relative;
}


.navigation4  {
    float: left;
    width: 143px;
    height: 3px;
    margin: 0 2px 0 0;
    position: e;
}   
EN

回答 1

Stack Overflow用户

发布于 2021-05-26 22:45:24

代码语言:javascript
复制
I hope this answered your question...

    https://www.w3schools.com/css/tryit.asp?filename=trycss3_flexbox_flex-wrap_nowrap8

代码语言:javascript
复制
<!DOCTYPE html>
<html>
<head>
<style>
.flex-container {
  display: flex;
  flex-wrap: nowrap;
  background-color: DodgerBlue;
}

.flex-container > div {
  background-color: #f1f1f1;
  width: 100px;
  margin: 10px;
  text-align: center;
  line-height: 75px;
  font-size: 30px;
}
</style>
</head>
<body>
<h1>Flexible Boxes</h1>

<div class="flex-container">
  <div>1</div>
  <div>2</div>
  <div>3</div>  
  <div>4</div>
  <div>5</div>
  <div>6</div>  
  <div>7</div>
  <div>8</div>
</div>

<p>Try to resize the browser window.</p>
<p>A container with "flex-wrap: nowrap;" will never wrap its items.</p>
<p><strong>Note:</strong> Flexbox is not supported in Internet Explorer 10 or earlier versions.</p>

</body>
</html>

代码语言:javascript
复制
</html>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67707224

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档