环绕图像的 Html 文本

标签 html css image word-wrap

我正在使用灵活的盒子模型制作一个网站。我试图让文本对齐到图像的右侧,然后在图像下方。我尝试了 Float:right/left 和 align="left/right",它们只是让图像消失了。这是因为灵活的盒子模型吗?这是源代码。这篇文章是我使用的《坦克世界》网站上的示例。

<div id="content">
    <section id="section">
        <div id="title">
            <h1>This is the Title</h1>
        </div>
        <div id="info-p">
            <div id="photo">
                <img id="img" src="400x300.png">
            </div>
        <article id="info">
            <p>
                US Army tankers, by late March 1945, when the final surge into Germany began, were among the most savvy graduates of the school of war. They knew how to storm cities and deal with small groups of defenders in villages or at crossroads. They could slog through fortifications and run like the cavalry of old. By and large, they had worked out effective teamwork strategies with the infantry, tank destroyers, and artillery, even if still a bit ambivalent about their friends in the fighter-bombers above them. They had learned to beat better tanks and worked out a series of pragmatic technical solutions to problems ranging from communication to moving on ice.

The German Army fought on like a body without a brain—OKW records show it was often a couple days behind developments on the battlefield, and headquarters at all levels had difficulty delivering orders to units that often existed only on paper. Lt. Gen. George Patton’s G-2 shop estimated that as of March 17, total German tank strength on the western front amounted to the equivalent of a single full-strength panzer division.1 As of March 31, the entire force of panzers and assault guns in Third Army’s sector was estimated at only 55 vehicles, all opposite XX Corps in the Fulda area.2

Cornelius Ryan captured the essence of the final push: “The race was on. Never in the history of warfare had so many men moved so fast. The speed of the Anglo-American offensive was contagious, and all along the front, the drive was taking on the proportions of a giant contest.”3 So fast, indeed; between April 24 and 30, the 737th Tank Battalion moved 520 miles.4

The Ninth Army pounded in the direction of Berlin all the way to the Elbe River. Just to the    south, First Army advanced to the Mulde River. Patton’s Third Army drove toward Czechoslovakia, and Seventh Army pushed through Bavaria toward the rumored Nazi National Redoubt in the Bavarian Alps and Austria.5

The tankers rolled past columns of German POWs heading for the rear, often with no supervision.     Increasingly, displaced persons and released Allied POWs also appeared.
            </p>
        </article>

    </section>


</div>

IDK 为什么有些文章与代码分开了。这是 CSS

#section{
font: 14px Trebuchet MS;
}
#title{
text-align:left;
display:-webkit-box;
-webkit-box-pack:left;
padding:5px;
margin:10px;
}
#info-p{
display:-webkit-box;
-webkit-box-pack:left;
padding:5px;
margin:10px;
}
#photo{


}
#info{
display:-webkit-box;
-webkit-box-pack:left;
-webkit-box-flex:1;
padding:5px;
margin:10px;
max-width:800px;

}

感谢您的帮助。抱歉格式错误,这是我在这里的第一篇文章

最佳答案

webkit 框是它的缺点...不过,从语义上将它放在文章中是正确的方法。

这很好用:http://jsfiddle.net/34u4bhkh/

#section{
font: 14px Trebuchet MS;
}
#title{
text-align:left;
display:-webkit-box;
-webkit-box-pack:left;
padding:5px;
margin:10px;
}
#info-p{
padding:5px;
margin:10px;
}
#photo{
float:right;
    margin-left:5px;
    margin-bottom:5px;

}
#info{
padding:5px;
margin:10px;
max-width:800px;

}

关于环绕图像的 Html 文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26599236/

相关文章:

css - Chrome 开发工具将链接标签替换为样式标签

javascript - 用JS访问ejs文件中的静态文件

javascript - 如果元素具有类和特定值,则 jquery 显示内容

html - 使用 HTML5/CSS3 的图像堆栈

html - 将 flexbox 与绝对位置子项一起使用?

android - 如何将 PictureDrawable 转换为位图

c# - 如何在 WPF 中从 System.Drawing.Image 创建 ImageBrush?

html - 如何在 AngularJS 中使用 ng-options 和 ng-init

javascript - 有没有比这更好的方法来仅使用 JavaScript(根本没有 JQuery)创建切换功能?

Java:如何在尽可能小的表面上绘制图像?