html - 试图让所有图像水平显示而不是垂直显示

标签 html css

这是我在论坛上的第一个问题,如果它不专业,我很抱歉希望我能从这篇文章中的错误中吸取教训!!

我把问题放在了标题中,但如果您有任何问题,请随时在下面提问,谢谢!寻求帮助!

我的代码

html {
  font-family: Arial, sans-serif;
}

html,
body {
  background-color: #67B177;
  margin: 0;
  padding: 0;
}

.wrapper {
  width: 100%;
  background-color: #4B574E;
}

.wrapper_nav {
  display: grid;
  width: auto;
  height: 50px;
}

.wrapper_nav a {
  text-decoration: none;
  color: white;
  padding: 0 1em;
  font-size: 30px;
}

.nav_left {
  text-align: left;
  margin-left: 10%;
  margin-top: 0.4em;
}

.nav_right {
  float: right;
}

.text {
  color: darkslategray;
}

.wrapper_body {}

.text-align-right {
  text-align: right;
}

.text-align-center {
  text-align: center;
}

h2 {
  font-family: helvetica;
  font-size: 64px;
  text-decoration: none;
  color: beige;
  margin-top: 50px;
  margin-bottom: 50px;
}

h3 {
  font-size: 64px;
  text-decoration: none;
  color: beige;
  margin-top: 00;
  margin-bottom: 150px;
}

.text2:hover {
  color: darkgray;
}

.text3:hover {
  color: #67B177;
}

p {
  color: beige;
  font-family: sans-serif;
  font-size: 16px;
}

.object-align-left {
  margin-right: 10px;
  margin-left: 100px;
  width: 50;
}

.object-align-center {
  margin-right: 300px;
  margin-left: 500px;
}

.object-align-right {
  margin-right: 300px;
  margin-left: 500px;
}

.overlay {
  position: absolute;
  bottom: 0;
  left: 100%;
  right: 0;
  background-color: #008CBA;
  overflow: hidden;
  width: 0;
  height: 100%;
  transition: .5s ease;
}

.container:hover .overlay {
  width: 100%;
  left: 0;
}

a {
  text-decoration: none;
}

.textone {
  margin-left: -170px;
  line-height: 100px;
  font-family: sans-serif;
  color: beige
}

.imageone {
  margin-bottom: 50px;
}

.textone:hover {
  color: #4B574E;
}

imagegrid {
  display: grid;
}

.texttwo {
  margin-left: -150px;
  line-height: 250px;
  font-family: sans-serif;
  color: beige;
}

.textthree {
  margin-left: -150px;
  line-height: 250px;
  font-family: sans-serif;
  color: beige;
}

.inline-block {
  display: inline-block;
}
<html>

<head>
  <title>Portfolio</title>
  <link rel="stylesheet" type="text/css" href="css/main.css">
</head>

<body>
  <div class="wrapper">
    <div class="wrapper_nav">
      <div class="nav_left">
        <div class="text">
          <div class="text2">
            <a href="#" class="text2">HOME</a>
            <a href="#" class="text2">EXPERIENCE</a>
            <a href="#" class="text2">CONTACT</a>
            <a href="#" class="text2">ABOUT</a>
            <a href="#" class="text3">LOGIN</a>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="text-align-center">
    <h2>BUSINESS</h2>
  </div>
  <div class="inline-block">
    <div class="object-align-left">
      <div class="container">
        <div class="">
          <a href="#">
            <img src="images/pen-icon.svg" height="200" class="imageone">
            <a class="textone"><b>EXPERIMENTAL</b></a>
          </a>
        </div>
      </div>
    </div>
    <div class="object-align-center">
      <a href="#">
        <img src="images/logo.svg" height="200">
        <a class="texttwo"><b>FAST</b></a>
      </a>
    </div>
    <div class="object-align-right">
      <a href="#">
        <img src="images/house-309113_1280.png" height="200">
        <a class="textthree">INNOVATIVE</a>
      </a>
    </div>
  </div>
  <div class="text-align-center">
    <h3>FREELANCE WORK</h3>
  </div>
</body>

</html>

最佳答案

我对你的代码做了一些修改,你可以在这里看到:

HTML:

<div class="wrapper">
<div class="wrapper_nav">
<div class="nav_left">
        <div class="text">
            <div class="text2">
                <a href="#" class="text2">HOME</a>
                <a href="#" class="text2">EXPERIENCE</a>
                <a href="#" class="text2">CONTACT</a>
                <a href="#" class="text2">ABOUT</a>
                <a href="#" class="text3">LOGIN</a>
            </div>
        </div>
    </div>
</div>
</div>
<div class="section1">
            <h2>BUSINESS</h2>
</div>
<div class="section2">
<div class="object">
            <a href="#">
                <img src="https://dummyimage.com/200x200/4b574e/ffffff.png" height="200">
                <a class="textone"><b>EXPERIMENTAL</b></a>
            </a>
</div>
<div class="object">
            <a href="#">
                <img src="https://dummyimage.com/200x200/4b574e/ffffff.png" height="200">
                <a class="textone"><b>FAST</b></a>
            </a>
</div>
<div class="object">
            <a href="#"> 
                <img src="https://dummyimage.com/200x200/4b574e/ffffff.png" height="200">
                <a class="textone">INNOVATIVE</a>
            </a>
</div>
</div>
        <div class="section3">
                <h3>FREELANCE WORK</h3>
        </div>

CSS:

html{
font-family: Arial,sans-serif;
}
html, body{
background-color:#67B177;
margin: 0;
padding: 0;
}
.wrapper {
width: 100%;
background-color: #4B574E;
}
.wrapper_nav{
display:grid;
width: auto;
height: 50px;
}
.wrapper_nav a{
text-decoration: none;
color: white;
padding: 0 1em;
font-size: 30px;
}
.nav_left{
text-align: left;
margin-left: 10%;
margin-top: 0.4em;
}
.nav_right{
float: right;
}
.text{
color: darkslategray;
}
.wrapper_body{

}
.section1{
text-align: center;
}
.section3{
text-align: center;
display: block;
padding-top: 50px;
clear: both;
overflow: hidden;
}
h2{
font-family:helvetica;
font-size: 64px;
text-decoration:none;
color:beige;
margin-top: 50px;
margin-bottom: 50px;
}
h3{
font-size: 64px;
text-decoration: none;
color: beige;
margin-top: 00;
margin-bottom: 150px;
}
.text2:hover{
color: darkgray;
}
.text3:hover{
color:#67B177;
}
p{
color: beige;
font-family: sans-serif;
font-size: 16px;
}
.overlay {
position: absolute;
bottom: 0;
left: 100%;
right: 0;
background-color: #008CBA;
overflow: hidden;   
width: 0;
height: 100%;
transition: .5s ease;
}
.container:hover .overlay {
width: 100%;
left: 0;
}
a{
text-decoration: none;
}
.textone{
font-family:sans-serif;
color: beige;
display: block;
margin-top: 15px;
text-align:center;
}
.imageone{
margin-bottom: 50px;
}
.textone:hover{
color: #4B574E; 
}
imagegrid{
display: grid;
}
.section2{
width: 900px;
margin: 0px auto;
}

.object{
float: left;
padding: 0 50px;
}

Codepen 上的代码 https://codepen.io/mehdiyatrib/full/mMOVQK

关于html - 试图让所有图像水平显示而不是垂直显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45496750/

相关文章:

html - css 下拉菜单阻塞父菜单

css - 如何在 twitter bootstrap 中显示表格(即使它是空的)

html - Fontawesome 在最新的 IE 中不起作用

html - Bootstrap 输入组内数字输入的溢出宽度

javascript - 如何获取拖放目标div的父ID?

php - 使用 javascript 更改 URL 哈希-设置后恢复为空白

html - 提交按钮图像溢出 - HTML

html - 制作两个相同大小的div

php - 也许是一个关于 html/php/sql 的简单问题

javascript - 启用禁用按钮 html5/css/javascript