如何使该图像位于文本下方?

时间:2019-04-02 03:27:20

标签: css html5 image css3

我不知道该如何在文字下方获得该图片。                    

    <h1>OUR Services</h1>
    <p>DESIGN CONTRACT
         Examples

  Starting from $1,800…

    It all starts with your vision. We develop that vision and help you 
    shape it into reality. That development starts with a plan. Our Design 
     Contracts are detailed, comprehensive and collaborative. <img 
     src="design.png" alt="house example"></p>
    </div>

浮动,对齐中间是我尝试过的方法。

我只想要文字下面的图片!也许它以为我要一条手臂和两条腿。 https://imgur.com/a/vFfeS0u

https://codepen.io/admitdefeat/pen/BEyMzK

3 个答案:

答案 0 :(得分:0)

只需定义属性display

img{
  display: block;
}

OR

更改标记结构

<p>DESIGN CONTRACT
Examples

Starting from $1,800…

It all starts with your vision. We develop that vision and help you shape it into reality. That development starts with a plan. Our Design Contracts are detailed, comprehensive and collaborative. </p>
 <img src="https://tinypng.com/images/example-shrunk.png" alt="house example" />

答案 1 :(得分:0)

如果您想要简单而不是复杂的东西,我认为表格是个不错的选择

<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY BGCOLOR=Coral>
<TABLE BORDER=0 ALIGN=CENTER>
<TR>
<TD ALIGN=CENTER><FONT SIZE=5>OUR Services</FONT></TD>
</TR>
<TR>
<TD ALIGN=CENTER>DESIGN CONTRACT Examples Starting from $1,800... it all     starts     whit your<br>vision.We develop the vision and help you shape it into     reality.That<br>development starts with a plan. Our Design Contracts are detailed.</TD>
</TR>
<TR>
<TD ALIGN=CENTER><IMG     SRC="C:\Users\marti\Desktop\Html\f43fc3ced583705f36926b6c9ebf3222--pearler-beads-fuse-beads.jpg"></TD>
</TR>
<TR>
<TD ALIGN=CENTER>comprehensive and collaborative</TD>
</TR>
</TABLE>
</BODY>
</HTML>

答案 2 :(得分:0)

我尝试了使用图像的代码,并且效果很好。我没有更改您的主要代码,只更改了图像。希望这对您有所帮助!

body {
	   color: #454547;
	font-family: "Basier";
	font-size: 1.2rem;
    -webkit-font-smoothing: antialiased;
    line-height: 1.9rem;
}
html { 
  background-color: #fdfaeb;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  background-size: cover;
  box-sizing:border-box;
}
.en{ 
  background: url(summer.jpg) no-repeat center center fixed; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  background-size: cover;
  box-sizing:border-box;
}

.container{    
    position: relative;
    top: 200px;
	box-sizing: inherit;
    width: 37%;
    margin: 0px auto;
    background: #fdfaeb;
    color: #2f3036;
    text-align: center;
}
div {
    display: block;
}


@font-face { 
	font-family: "Basier";
	src: url("basiersquare-regular-webfont.ttf");
}
header {
    position: relative;
}
.logo {
    position: absolute;
    left: 10px;
	width: 150px;
	height: 140px;
    float: left;
}
#menu {
    position: absolute;
    right: 10px;
}

/*Strip the ul of padding and list styling*/
ul {
    list-style-type:none;
    margin:0;
    padding:0;
    position: absolute;
}
/*Create a horizontal list with spacing*/
li {
    display:inline-block;
    float: left;
    margin-right: 0 px;
}
/*Style for menu links*/
li a {
    display:block;
    min-width:140px;
    height: 50px;
    text-align: center;
    line-height: 50px;
    font-family: "Basier";
    color: #2f3036;
    background: #fdfaeb;
    text-decoration: none;
}
/*Hover state for top level links*/
li:hover a {
    background: #F4D03F;
}
/*Style for dropdown links*/
li:hover ul a {
    background: #F4D03F;
    color: #2f3036;
    height: 40px;
    line-height: 40px;
}
/*Hover state for dropdown links*/
li:hover ul a:hover {
    background: #fdfaeb;
    color: #2f3036;
}
/*Hide dropdown links until they are needed*/
li ul {
    display: none;
}
/*Make dropdown links vertical*/
li ul li {
    display: block;
    float: none;
}
/*Prevent text wrapping*/
li ul li a {
    width: auto;
    min-width: 100px;
    padding: 0 20px;
}
/*Display the dropdown on hover*/
ul li a:hover + .hidden, .hidden:hover {
    display: block;
}
/*Style 'show menu' label button and hide it by default*/
.show-menu {
    font-family: "Basier";
    text-decoration: none;
    color: #F4D03F;
    background: #fdfaeb;
    text-align: center;
    padding: 10px 0;
    display: none;
}
/*Hide checkbox*/
input[type=checkbox]{
    display: none;
}
/*Show menu when invisible checkbox is checked*/
input[type=checkbox]:checked ~ #menu{
    display: block;
}
/*Responsive Styles*/
@media screen and (max-width : 760px){
    /*Make dropdown links appear inline*/
    ul {
        position: static;
        display: none;
    }
    /*Create vertical spacing*/
    li {
        margin-bottom: 1px;
    }
    /*Make all menu links full width*/
    ul li, li a {
        width: 100%;
    }
    /*Display 'show menu' link*/
    .show-menu {
        display:block;
    }

	
<!DOCTYPE html>
<html lang="en">
<head>
	<title>CLT Designs Home Remodeling & Renovations</title>
	<link href="hoise.ico" rel="shortcut icon" type="image/x-icon">
	<meta charset="utf-8">
	<link href="designs.css" rel="stylesheet">
</head>
<body>

	
<img class="logo" src="https://www.flowersbylindsey.com/catalog/view/theme/shoppica2/image/po_gallery/po-gallery-square-200_.png" alt="logoclt">
	
	
	 <label for="show-menu" class="show-menu">Show Menu</label>
    <input type="checkbox" id="show-menu" role="button">
        <ul id="menu">
        <li><a href="thahomepage.html">Home</a></li>
        <li><a href="ABOUT.html">About</a></li>
        <li>
            <a href="Services.html">Services</a>
            <ul class="hidden">
                <li><a href="Design.html">What is Design + Build?</a></li>
                <li><a href="#">Our Process</a></li>
            </ul>
        </li>
	<li><a href="Portfolio.html">Portfolio</a></li>	
        <li><a href="Contact.html">Contact</a></li>
    </ul>
	
		<div>
		<div class="container">
		
		<h1>OUR Services</h1>
		<p>DESIGN CONTRACT
Examples

Starting from $1,800…

It all starts with your vision. We develop that vision and help you shape it into reality. That development starts with a plan. Our Design Contracts are detailed, comprehensive and collaborative. <img src="https://www.flowersbylindsey.com/catalog/view/theme/shoppica2/image/po_gallery/po-gallery-square-200_.png" alt="house example"></p>
		</div>
		</div>