使图像和文本在div中彼此相邻

时间:2020-12-14 11:31:05

I wrote a code as shown here.
You can see that image is coming on top and text is going down. I want both image and text to come in same line.
CSS:

我写了一个如下所示的代码。您可以看到图像显示在顶部,文本正在下降。我希望图像和文字都在同一行。 CSS:

#menu{
    background: #003663 repeat scroll 0% 0%;
    width: 100%;
    min-width: 1000px;
    height: 63px;
}
#menu #plc{
    width: 82%;
    margin: 0px auto;
    overflow: hidden;
}
#menu #plc #register{
    color: #fff;
    font-size: 21px;
    margin: 1% 0 0 0;
    background-color: red;
    width: 12%;
}
#menu #plc #register img{
    width: 15.5%;
    margin-left: 7%;
}  

How can I do it?

我该怎么做?

1 个解决方案

#1


2  

Try this:

CSS

#register img, #register div{
    display:inline-block;
    vertical-align: middle;
}

DEMO HERE

#1


2  

Try this:

CSS

#register img, #register div{
    display:inline-block;
    vertical-align: middle;
}

DEMO HERE