<style> .a{border:1px solid red;height:50px;} .b{border:1px solid blue;float:left;} .c{border:1px solid green;float:left;}</style><div class="a"> <div class="b">bbbbbbbbbbbbbbbbb</div> <div class="c">ccccccccccccccccc</div></div>
我想让b和c 两个div 居中,该怎么弄
回复讨论(解决方案)
<!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><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><style> .a{border:1px solid red;height:50px;} .b{border:1px solid blue;} .c{border:1px solid green;} .w200{width:200px;} .ctn{margin:0 auto;}</style></head><body><div class="a"> <div class="b ctn w200">bbbbbbbbbbbbbbbbb</div> <div class="c ctn w200">ccccccccccccccccc</div></div></body></html>
居中:margin:0 auto,
有float:left是不可能作到居中的,
1楼,我要的是b c 两个层左右排列
1楼,我要的是b c 两个层左右排列
如果不想让a居中,又不能在b,c的外面套一个元素,是实现不了的
看看二楼的东西
可以的吧,在body里面设置元素居中吧。
<!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><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title> </script></head><body><style> .a{border:1px solid red;height:50px;} .d{ width:404px;margin:auto;} .b{border:1px solid blue; width:200px; float:left; } .c{border:1px solid green; width:200px; float:left;}</style><div class="a"> <div class="d"> <div class="b">bbbbbbbbbbbbbbbbb</div> <div class="c">ccccccccccccccccc</div> </div></div><div id="content"></div></body></html>
<style> .a{border:1px solid red;height:50px;} .b{padding-left:12px;padding-right:12px;border:1px solid blue;} .c{border:1px solid green;float:left;} .d{width:300px;margin:0 auto;} .b,.c{text-align:center;}</style><div class="a"><div class="d"> <div class="b">bbbbbbbbbbbbbbbbb</div> <div class="c">ccccccccccccccccc</div></div></div>
楼上的方法不错,\
margin:auto;
我还真很少这样用,我用text_align:center这样不行

HTMLtagsdefinethestructureofawebpage,whileattributesaddfunctionalityanddetails.1)Tagslike,,andoutlinethecontent'splacement.2)Attributessuchassrc,class,andstyleenhancetagsbyspecifyingimagesources,styling,andmore,improvingfunctionalityandappearance.

HTML的未来将朝着更加语义化、功能化和模块化的方向发展。1)语义化将使标签更明确地描述内容,提升SEO和无障碍访问。2)功能化将引入新元素和属性,满足用户需求。3)模块化将支持组件化开发,提高代码复用性。

htmlattributesarecrucialinwebdevelopment forcontrollingBehavior,外观和功能

alt属性是HTML中标签的重要部分,用于提供图片的替代文本。1.当图片无法加载时,alt属性中的文本会显示,提升用户体验。2.屏幕阅读器使用alt属性帮助视障用户理解图片内容。3.搜索引擎索引alt属性中的文本,提高网页的SEO排名。

HTML、CSS和JavaScript在网页开发中的作用分别是:1.HTML用于构建网页结构;2.CSS用于美化网页外观;3.JavaScript用于实现动态交互。通过标签、样式和脚本,这三者共同构筑了现代网页的核心功能。

设置标签的lang属性是优化网页可访问性和SEO的关键步骤。1)在标签中设置lang属性,如。2)在多语言内容中,为不同语言部分设置lang属性,如。3)使用符合ISO639-1标准的语言代码,如"en"、"fr"、"zh"等。正确设置lang属性可以提高网页的可访问性和搜索引擎排名。

htmlattributeseresene forenhancingwebelements'functionalityandAppearance.TheyAdDinformationTodeFineBehavior,外观和互动,使网站互动,响应式,visalalyAppealing.AttributesLikutesLikeSlikEslikesrc,href,href,href,类,类型,类型,和dissabledtransfransformformformformformformformformformformformformformformforment

toCreateAlistinHtml,useforforunordedlistsandfororderedlists:1)forunorderedlists,wrapitemsinanduseforeachItem,RenderingeringAsabulleTedList.2)fororderedlists,useandfornumberedlists,useandfornumberedlists,casundfornumberedlists,customeizableWithTheTtheTthetTheTeTeptTributeFordTributeForderForderForderFerentNumberingSnumberingStyls。


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

ZendStudio 13.5.1 Mac
功能强大的PHP集成开发环境

记事本++7.3.1
好用且免费的代码编辑器

VSCode Windows 64位 下载
微软推出的免费、功能强大的一款IDE编辑器

SublimeText3 Linux新版
SublimeText3 Linux最新版

SublimeText3 英文版
推荐:为Win版本,支持代码提示!