❶ div里图片与文字水平居中对齐
通过css样式<style type="text/css" id="internalStyle">
#container{
text-align: center;
width: 640px;
padding: 20px 0 20px 0;
border: 1px solid #339;
background: #EEE;
white-space: nowrap;
}
img, p{
display: inline;
vertical-align: middle;
font: bold 12px "宋体", serif;
color: #666;
}
</style>
<div id="container">
<img src=" http://community.csdn.net/images/CSDN_logo.GIF" alt="aaa">
<p>文字层</p>
<p>Text Layer</p>
<img src=" http://community.csdn.net/images/CSDN_logo.GIF" alt="aaa">
</div>
❷ 怎么让文字对准图片的中间呀 (这是html)怎么用css
需要准备的材料分别有:电脑、浏览器、html编辑器。
1、首先,打开html编辑器,新建html文件,例如:index.html,填充问题基础代码。
❸ 将图片和文字左右居中对齐
1、首先在电脑中打开word文档,选中所需的图片。选择工具栏中的“插入”标签,点击“文本框”,如下图所示。
❹ div中左边有图片,右边有文字,我要中间两行文字左边对齐;即下图1和2与logo对齐。
代码如下,内容你自己调下:
<div>
<div style="width:66px;height:66px;float:left;"><img src="https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/iknow/avarta/66/r6s1g4.gif" width="66" height="66" /></div>
<div style="width:100px;height:66px;float:left;">
<p>第一行文字</p>
<p>第二行文字</p>
</div>
</div>
❺ 在一个DIV中怎样让文字跟图片居中对齐
兄弟,我给你写了个示例,把下面代码复制过去看看吧:
DIV中怎样让文字跟图片居中对齐的键在于这个属性 vertical-align:middle;
------------------------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>无标题页</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style>
body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, button, textarea, p, blockquote, th, td { margin: 0; padding: 0; font-size:12px; }
.clearfix:after { content:'\0020'; display:block; height:0; clear:both; }
.clearfix { *zoom:1;
}
.test { height:100px; width:200px; line-height:100px; border:solid 1px #000; margin:100px auto; padding:0 30px; }
.test img{border:solid 1px #000; vertical-align:middle;}
</style>
</head>
<body>
<div class="test">
这个对齐了<img src="http://img..com/img/logo-.gif" />
</div>
</body>
</html>
❻ html如何使文字和图片的中部对齐
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/>
<title>无标题文档</title>
<style>
.main{vertical-align:middle}
</style>
</head>
<body>
<divclass="main">
我是和图片居中对齐滴。<imgsrc="file:///C|/Users/Administrator/Desktop/QQ图片20150403172529.png"style="vertical-align:middle"width="276"height="267"/>
</div>
</body>
</html>
❼ HTML语言中,怎样把一段文字和居中图片对齐。
代码加上,align=“center”,就可以了!还不懂的话可以再给你一个案例~
❽ 文字和图片在同一个DIV中,要让图片居中,文字靠左对齐,并且,只能设置DIV的CSS,如何做到
div {}
div p {text-align:left;}
div p img {margin:0 auto; display:block;}
把图片变成块级元素显示就可以了
❾ 怎么用DIV+CSS实现图片和文字垂直中心对齐
一行文字可以通过line-height和高度相同来实现垂直中心对齐,图片的话可以给图片添加vertical-align:middle;来实现,示例如下:
<style>
p{line-height:100px;hieght:100px;text-align:center;}
div{height:200px;text-align:center;}
divimg{vertical-align:middle;width:80px;height:80px;}
</style>
<p>示例文字</p>
<div><imgsrc="图片"/></div>
如果是多行文字的话就得用到CSS的表格特性来做,示例如下:
<style>
.box{position:relative;width:200px;height:200px;margin:40pxauto0auto;background:#282d33;border:solid1px#171717;box-shadow:inset001pxrgba(255,255,255,0.4);color:#bbb;}
.box.tag{position:absolute;top:-11px;left:70px;width:60px;height:20px;background:#1b1b1b;border:solid1px#171717;text-align:center;}
/*IE6+支持图片和多行文字水平垂直居中*/
.ie_imgText{display:table;width:200px;height:200px;text-align:center;*position:relative;}
.ie_imgText.cell{vertical-align:middle;display:table-cell;*position:absolute;*top:50%;*left:50%;}
.ie_imgText.content{*position:relative;*top:-50%;*left:-50%;}
</style>
<divclass="box">
<divclass="ie_imgText">
<divclass="cell">
<divclass="content">
<imgsrc="图片"alt="">
<p>文字文字</p>
<p>文字文字文字</p>
</div>
</div>
</div>
</div>