简体   繁体   English

如何在Bootstrap网格中的图像旁边放置标题?

[英]How can I have a title placed next to an image in a Bootstrap grid?

I am looking to replicate Apple's iPhone messaging interface. 我希望复制Apple的iPhone消息传递界面。 However, I cannot get the name of the person in the inbox to appear next to the initials icon and I cannot get the small grey letters to be underneath the person's name. 但是,我无法在收件箱中看到该人的名字并显示在姓名首字母图标旁边,并且我也无法在该人的名字下方看到灰色的小字母。 I have included a screen shot so that you can have a better idea of what I am looking to do! 我提供了一个屏幕截图,以便您可以更好地了解我要做什么!

Here is my current HTML markup code that I have: 这是我当前拥有的HTML标记代码:

<section class="messaging-body">
    <div class="container">
        <div class="row">
            <div class="col-xs-6 col-md-6">
                <div class="messaging-icon">
                    <img class="img-responsive" src="message-name.png">
                </div>
            </div>
        </div>
    </div>
</section>

Current image 当前图像
Desired image 所需图片

Please let me know if you have any idea on how to make this work. 如果您对如何进行这项工作有任何想法,请告诉我。 Thanks! 谢谢!

Is it possible that the width of the initials is to big? 缩写的宽度是否可能太大? Did you try using col-md-2 or col-md-1 for the initials? 您是否尝试将col-md-2或col-md-1用作缩写? Also, you can use inline-block in CSS to align the two text boxes with the initials image. 另外,您可以在CSS中使用内联块将两个文本框与首字母图像对齐。 I'd wrap the text in one div so that you only have to align this one. 我会将文本包装在一个div中,这样您只需要对齐该文本即可。 From the code you posted, this would be my best guess! 根据您发布的代码,这将是我的最佳猜测!

<section class="messaging-body">
    <div class="container">
        <div class="row">
            <div class="col-xs-2 col-md-2">
                <div class="messaging-icon">
                    <img class="img-responsive" src="message-name.png">
                </div>
            </div>
            <div class="col-xs-10 col-md-10">
                <div class="message">
                    <h4>Name of the person</h4>
                    <p>Lorem Ipsum dolor sit amet, dicta paulo no est...</p>
                </div>
            </div>
        </div>
    </div>
</section>

CSS 的CSS

.message {
    display: inline-block;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM