搜索
首页web前端html教程利用table实现页面实现移动端页面自适应表单_html/css_WEB-ITnose

为了实现如图所示的效果:

设置table的宽度为百分比的值,让其宽度随页面的宽度而改变。input占据整个td的宽度。
主要html代码如下:

<form action="">    <table class="form">        <tr>            <td colspan="3"><input type="text" placeholder="姓名" name="username" id="user"/><span></span></td>        </tr>        <tr>            <td colspan="3"><input type="text" placeholder="公司名称" name="company" id="company"/><span></span></td>        </tr>        <tr>            <td colspan="3"><input type="text" placeholder="国家/地区" name="area" id="area"/><span></span></td>        </tr>        <tr>            <td colspan="3"><input type="phone" placeholder="手机" name="phone" id="phone"/><span></span></td>        </tr>        <tr>            <td colspan="3"><input type="email" placeholder="电子邮箱" name="email" id="email"/><span></span></td>        </tr>        <tr>            <td colspan="3"><input type="text" placeholder="确认邮箱" name="email-c" id="email-c"/><span></span></td>        </tr>        <tr>            <td class="r-box pl8" width="37%">是否开具发票</td><td class="r-box" width="21.9%"><label for="bill_y" class="r-label checked"><input type="radio" name="bill" id="bill_y"/>是</label></td><td class="r-box"><label for="bill_n" class="r-label"><input type="radio" name="bill" id="bill_n"/>否</label></td></td>        </tr>        <tr>            <td colspan="3"><input type="text" placeholder="抬头"/><span></span></td>        </tr>        <tr>            <td colspan="3" class="pb6"><input type="text" placeholder="联系地址"/><span></span></td>        </tr>        <tr>            <td colspan="3"><input type="submit" value="继续"/></td>        </tr>    </table></form>

主要的scss样式如下:

.form{  width: 96%;  margin: 0.3rem auto;  font-size: 0.7rem;  td{    height: 2.5rem;  }  input{    font-family: "Microsoft Yahei";    outline: none;    color: #d8d8d8;  }  input[type=text],input[type=phone],input[type=email]{    border: 1px solid #e10000;    height: 1.55rem;    line-height: 1.55rem;    padding-left: 0.4rem;    width: 100%;    box-sizing: border-box;    background: transparent;  }
声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
如何在标签上设置lang属性?为什么这很重要?如何在标签上设置lang属性?为什么这很重要?May 08, 2025 am 12:03 AM

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

HTML属性的目的是什么?HTML属性的目的是什么?May 07, 2025 am 12:01 AM

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

您如何在HTML中创建列表?您如何在HTML中创建列表?May 06, 2025 am 12:01 AM

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

HTML行动:网站结构的示例HTML行动:网站结构的示例May 05, 2025 am 12:03 AM

HTML用于构建结构清晰的网站。1)使用标签如、、定义网站结构。2)示例展示了博客和电商网站的结构。3)避免常见错误如标签嵌套不正确。4)优化性能通过减少HTTP请求和使用语义化标签。

您如何将图像插入HTML页面?您如何将图像插入HTML页面?May 04, 2025 am 12:02 AM

toinsertanimageIntoanhtmlpage,usethetagwithsrcandaltattributes.1)usealttextforAcccessibilityandseo.2)instementRcsetForresponSiveImages.3)applylazyloadingWithLoadingWithLoading =“ lazy” tooptimizeperformance.4)tooptimizeperformance.4)

HTML的目的:启用Web浏览器可以显示内容HTML的目的:启用Web浏览器可以显示内容May 03, 2025 am 12:03 AM

HTML的核心目的在于让浏览器理解并展示网页内容。1.HTML通过标签定义网页结构和内容,如、到、等。2.HTML5增强了多媒体支持,引入了和标签。3.HTML提供了表单元素,支持用户交互。4.优化HTML代码可提升网页性能,如减少HTTP请求和压缩HTML。

为什么HTML标签对Web开发很重要?为什么HTML标签对Web开发很重要?May 02, 2025 am 12:03 AM

htmltagsareessentialforwebdevelopmentastheyandendenhancewebpages.1)heSdefinElayout,语义和互动性。2)SemantictagsiCtagSimproveCacsibilitieAndseo.3)pose poseriblesibilityAndseoandseo.3)poser

说明将一致的编码样式用于HTML标签和属性的重要性。说明将一致的编码样式用于HTML标签和属性的重要性。May 01, 2025 am 12:01 AM

一致的HTML编码风格很重要,因为它提高了代码的可读性、可维护性和效率。1)使用小写标签和属性,2)保持一致的缩进,3)选择并坚持使用单引号或双引号,4)避免在项目中混合使用不同风格,5)利用自动化工具如Prettier或ESLint来确保风格的一致性。

See all articles

热AI工具

Undresser.AI Undress

Undresser.AI Undress

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

AI Clothes Remover

AI Clothes Remover

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

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

Video Face Swap

Video Face Swap

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

热工具

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

禅工作室 13.0.1

禅工作室 13.0.1

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

PhpStorm Mac 版本

PhpStorm Mac 版本

最新(2018.2.1 )专业的PHP集成开发工具

EditPlus 中文破解版

EditPlus 中文破解版

体积小,语法高亮,不支持代码提示功能

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器