所以我正在尝试复制页面布局,它是一个图像,它是页面的完整高度,右侧有文本。文字宽度似乎根据图像调整,我只是不确定它是如何完成的。 http://mcgarrybowen.com/en/People/Bill-Borrelle那是页面,有关如何完成的任何想法?
这是我尝试的但是工作不正常,看起来像http://www.klossal.com/klossviolins/about.html:
<div style="width:100%;padding-top:40px;padding-bottom:40px;">
<div style="width:920px;position:relative;">
<div style="float:left;">
<img style="height:100%;" src="http://www.klossal.com/klossviolins/elements/horst.jpg" alt="">
</div>
<div style="float:left;">
<p style="color: #b9b8b4;
font-family: 'Source Sans Pro' , sans-serif;
font-size: 24px;
text-align: left;
position:relative;
width:auto;">About</p>
<p style="color: #b9b8b4;
font-family: 'Source Sans Pro' , sans-serif;
font-size: 14px;
text-align: left;
position:relative;
width:auto;">
Mittenwald-trained, Master Violin Maker, Horst Kloss, has worked with fine stringed instruments and bows for over three decades. The Kloss Shop specializes in the repair, restoration, appraisal and sale of historic instruments and bows. Mr. Kloss further offers acoustic adjustment tailored to the individual musician's requirements, the application of museum conservation standards to preserve instrument integrity and maintain value as well as baroque conversion. Mr. Kloss is experienced in providing musicians with custom instrument set up designed to prevent overuse syndrome while maintaining maximal adjustment of tonal color, clarity and projection.<br><br>
Since 1972, Horst Kloss has cared for collections of note along the East Coast of the United States, including the Boston Museum of Fine Art's collection of historic stringed instruments. He is one of under a hundred makers, nation-wide, whose extensive training and high caliber skills qualified him for full membership status in the American Federation of Violin and Bow Makers.<br><br>
Raised among musicians and makers, Horst Kloss was imbued with a love of music and a profound sense of stewardship in caretaking for stringed instruments. At the age of 14, he began an apprenticeship in his hometown of Mittenwald, a center for violin-making since the 1600's. He received his formal training at the Bavarian State School of Violin Making in Southern Germany where he earned his Journeyman's diploma in 1964 and his Master's degree in 1972 under the tutelage of Josef Kantuscher. He moved to the United States in 1964 following the exodus of finer instruments from Europe and gained exposure to many of them while working for Carl Becker at Lewis & Sons. Mr. Kloss instructs the courses offered in instrument repair and restoration at the University of New Hampshire's Violin Craftsmanship Institute. He established shops in Houston and Boston before settling in Needham, Massachusetts.<br><br>
Horst Kloss has attracted an international clientele, including many distinguished concert performers, who value his consistently high quality restoration and sound adjustments. His experienced eye and broad client base make him especially well-suited to bring buyers and sellers of fine stringed instruments together.</p>
</div>
<br class="clear">
</div>
答案 0 :(得分:0)
这里是一个简单的例子,说明如何在图像旁边显示文字:
<img class="SomeImage" src="http://www.klossal.com/klossviolins/elements/horst.jpg" alt="">
<span class="SomeText">Some text next to the image</span>
下面应该进入你的css文件
.SomeImage{
max-width:80%;/*give some room for your text*/
}
.SomeText{
vertical-align:top;
}
注意,css是在css类中,而不是内联。此外,你的工作不起作用的原因是因为你有彼此相邻的块元素,这将导致它包装到下一行。
另一种选择是使用表格。 http://jsfiddle.net/g5wpt/2/
答案 1 :(得分:0)
如果你宁愿避免一些棘手的CSS,或者发布运行js。如果可能的话,我可能只建议使用双列表。
表格单元格将根据内容调整自身大小,并且在所有浏览器中都可靠。由于文本可以缩小或增长,并且渲染器不会将其视为具有固定宽度,因此固定宽度图像会将其推出单元格,因此文本单元格将变小。
你唯一需要做的就是给桌子一个宽度,这样它就可以填满必要的空间,而不是更多或更少。
答案 2 :(得分:0)
无论如何,为了让你开始,在这个页面中,当你调整窗口大小时,这个家伙会相应地增长和缩小(如果你问我,这会有点令人毛骨悚然)。
无论如何,他们使用javascript来计算图片的宽度。但是,您可以单独使用HTML + CSS来完成类似的操作。
您只需将pic容器和文本容器的宽度设置为50%。
以下是一个例子:
<!DOCTYPE HTML>
<html>
<head>
<title>test</title>
<style>
#container {
width: 100%;
}
#text {
width: 48%;
float: left;
}
#pic-container {
float: left;
height: 50%;
}
#pic {
height: 100%;
}
</style>
</head>
<body>
<div id="container">
<div id="pic-container">
<img id="pic" src="http://mcgarrybowen.com/~/media/A6896FA26F97436E899BCE3307FFC1C2.ashx?as=0"/>
</div>
<div id="text">
Some really cool text lorem ipsum
</div>
<div style="clear: both"></div>
</div>
</body>
</html>