图片旁边的Div [英] Div next to image

查看:35
本文介绍了图片旁边的Div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在教< div> ,我遇到了问题.Div是在图片下,但我想在旁边.我尝试设置浮动,位置,但无济于事.

I'm teaching <div> and i have problem. Div is under image, but I want next to. I tried with setting float, position but nothing help.

Jsfiddle (此处div/图像未连接!)

Jsfiddle (here divs/images are unconnected!)

如何更改它以连接图像和表格?

How to change it to connect images and form on up?

推荐答案

div会自动创建一个换行符,因为它们是块元素.尝试在div上使用 display:inline-block .

Divs automatically create a line break, because they are block elements. Try using display: inline-block on the div.

我现在更新了您的小提琴: http://jsfiddle.net/aqqUV/3/

I updated your fiddle now: http://jsfiddle.net/aqqUV/3/

请注意此处的代码更改:

Note the code change here:

<div class="form" style="
    margin-left: 70px;
    color: white;
    display: inline-block;
">

这篇关于图片旁边的Div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆