将个人资料图片和标题与css对齐相结合

时间:2014-09-02 22:10:04

标签: html5 image css3 alignment tumblr

我正在尝试将个人资料照片与文字(标题)合并到我的tumblr theme

我在对齐方面遇到了问题。我还需要它在响应式视图方面做得很好。 (如果标题变大,它应该属于 - made a picture to illustrate

CSS

#header .user-portrait {
border-radius: 100%;
width: 40px;
height: 40px;
margin-right: 18px;
display: inline-block;
vertical-align: middle;
float: left;
}

#header a {
font-weight: bold;
display: block;
margin-bottom: 34px;
vertical-align: top;
}

#description {
color: {color:Description};
padding-right: {text:Minus width for header in px}px;
}

#page-masthead ul { 
margin: 0;
list-style-type: none;
display: block;
clear: both;
line-height: 1.92em;
padding-right: {text:Minus width for header in px}px;
}   

HTML:

<div id="page-masthead">
<div id="header">

<a href="/"><img src="{PortraitURL-40}" alt="" class="user-portrait"></a>

{block:IfShowblogtitle}
<a href="/">{Title}</a>
{/block:IfShowblogtitle}
</div>

1 个答案:

答案 0 :(得分:0)

最好的方法是当宽度足够小时使用媒体查询,如下所示;

@media only screen and (max-width: ??px) {

    #header .user-portrait {
        float: none;
        margin: 0 auto /* To center the "span" or whatever you're using */
    }

}