在HTML和CSS中围绕图像包装文本

在HTML和CSS中围绕图像包装文本,html,css,Html,Css,我试图把这篇文章包装成一张图片,但我尝试的一切似乎都不起作用 主要边界{ 文本对齐:居中; 背景:url../desktop/background.gif; 背景大小:100%100%; 高度:700px; 宽度:600px; 左边距:自动; 右边距:自动; } 主边界p{ 位置:相对位置; 利润率:50像素; } 英国巴黎:/ˈpærɪs/;美国:李斯特尼;法语:[帕伊]利斯特是法国的首都和人口最多的城市。它位于该国北部的塞纳河上,位于法兰西地区的中心,也被称为巴黎区域。2011年1月,巴黎

我试图把这篇文章包装成一张图片,但我尝试的一切似乎都不起作用

主要边界{ 文本对齐:居中; 背景:url../desktop/background.gif; 背景大小:100%100%; 高度:700px; 宽度:600px; 左边距:自动; 右边距:自动; } 主边界p{ 位置:相对位置; 利润率:50像素; } 英国巴黎:/ˈpærɪs/;美国:李斯特尼;法语:[帕伊]利斯特是法国的首都和人口最多的城市。它位于该国北部的塞纳河上,位于法兰西地区的中心,也被称为巴黎区域。2011年1月,巴黎市拥有2249975名居民,以城市范围内的人口衡量,它是欧盟第五大城市。巴黎及其郊区拥有12292895名居民,是欧洲第二大或第三大都市区,伦敦和柏林则是如此,这取决于所测量的面积

巴黎是在公元前3世纪由一个叫帕里西的凯尔特人建立的,他给这座城市起了名字。到了十二世纪,巴黎是西方世界最大的城市,繁荣的贸易中心,巴黎大学的故乡,欧洲第一家。十八世纪,它是法国大革命的中心舞台,成为金融、商业、时尚、科学和艺术的重要中心,至今仍保留着这一地位

只需将float:left添加到img标记

使用您的代码:

主要边界{ 文本对齐:居中; 背景:url../desktop/background.gif; 背景大小:100%100%; 高度:700px; 宽度:600px; 左边距:自动; 右边距:自动; } 主边界p{ 位置:相对位置; 利润率:50像素; } .wrap{float:left;} 英国巴黎:/ˈpærɪs/;美国:李斯特尼;法语:[帕伊]利斯特是法国的首都和人口最多的城市。它位于该国北部的塞纳河上,位于法兰西地区的中心,也被称为巴黎区域。2011年1月,巴黎市拥有2249975名居民,以城市范围内的人口衡量,它是欧盟第五大城市。巴黎及其郊区拥有12292895名居民,是欧洲第二大或第三大都市区,伦敦和柏林则是如此,这取决于所测量的面积

巴黎是在公元前3世纪由一个叫帕里西的凯尔特人建立的,他给这座城市起了名字。到了十二世纪,巴黎是西方世界最大的城市,繁荣的贸易中心,巴黎大学的故乡,欧洲第一家。十八世纪,它是法国大革命的中心舞台,成为金融、商业、时尚、科学和艺术的重要中心,至今仍保留着这一地位

见 加


对于CSS,这里有一些代码可以使文本环绕图像。


你是什么意思?你的意思是浮动图像,使文本向下移动?你厌倦了浮动图像吗?尝试在

中添加图片,然后看是的,我想浮动图像,使文本向下移动。我尝试过浮动图像,但似乎不起作用

#main-border{
   overflow: hidden; //to clear the float (instead of clearfix)
}

img{
   float: left;
   margin: 0 10px 10px 0;
}
#main-border {
  text-align: center;
  background : url(../desktop/background.gif);
  background-size : 100% 100%;
  height: 700px;
  width: 600px;
  margin-left: auto;
  margin-right: auto; 
  overflow: hidden; //to clear the float (instead of clearfix)
}

#main-border img.wrap{
    float: left;
    margin: 0 10px 10px 0; //adds some spacing
}
.wrap{
    float: left;
}
#main-border {
    text-align: justified;
    background : url(../desktop/background.gif);
    height: 700px;
    width: 600px;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid red;
    overflow: hidden;

    }


#main-border img {
  float: left;
  padding: 10px;

}


    #main-border p {
    position: relative;
    margin: 50px;

    }

<div id="main-border">
    <img src="../desktop/atitlan.jpg" width="300px" class="wrap">
     <p>Paris (UK: /ˈpærɪs/; US: Listeni/ˈpɛərɪs/; French: [paʁi] ( listen)) is the capital and most populous city of France. Situated on the Seine River, in the north of the country, it is in the center of the Île-de-France region, also known as the région parisienne. The City of Paris has a population of 2,249,975 inhabitants (January 2011), making it the fifth largest city in the European Union measured by the population within the city limits. Paris and its suburbs have a population of 12,292,895 inhabitants, making it the second or third largest metropolitan area in Europe, with London and Berlin, depending on the area measured.</p>

    <p>Paris was founded in the 3rd century BC by a Celtic people called the Parisii, who gave the city its name. By the 12th century, Paris was the largest city in the western world, a prosperous trading centre, and the home of the University of Paris, one of the first in Europe. In the eighteenth century, it was the centre stage for the French Revolution, and became an important centre of finance, commerce, fashion, science, and the arts, a position it still retains today.</p>

</div>