導航:首頁 > 文字圖片 > js圖片與文字中間對齊

js圖片與文字中間對齊

發布時間:2022-01-19 15:58:51

❶ 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>
閱讀全文

與js圖片與文字中間對齊相關的資料

熱點內容
男人帥氣發型圖片大全 瀏覽:817
word圖片怎麼變大排列 瀏覽:164
男生小眼睛的發型圖片 瀏覽:570
少女畫畫圖片簡單 瀏覽:484
word里怎麼把圖片弄成弧度的 瀏覽:728
女孩斗雞眼真人圖片 瀏覽:103
搞笑萌系動漫圖片 瀏覽:446
給男生撓腳心漫圖片 瀏覽:229
女蓋頭發型圖片 瀏覽:546
我是吃貨的文字圖片 瀏覽:390
白襪初中女生圖片 瀏覽:492
動漫騎士高清圖片 瀏覽:327
女主發型燙發圖片 瀏覽:338
表演區衣服製作圖片海綿紙 瀏覽:744
簡單的建築模型圖片 瀏覽:640
男生燙發長長後圖片 瀏覽:828
如何提取移動端頁面圖片 瀏覽:849
悟空時代衣服圖片 瀏覽:98
男士牛仔褲圖片價格 瀏覽:669
雜志美女可愛圖片 瀏覽:454