javascript - 這種評(píng)論表單的布局是怎么做出來的?
問題描述
這是簡(jiǎn)書的評(píng)論表單:
我的 html 結(jié)構(gòu)如下:
<form action='' method='post'> <a href='http://m.lshqa.cn/wenda/3430.html' class='avatar'><img src='http://m.lshqa.cn/wenda/images/avatar.jpg' alt=''></a> <textarea placeholder='寫下你的評(píng)論...'></textarea> <footer><span>Ctrl + Return 發(fā)表</span><button type='reset'>取消</button><button type='submit'>發(fā)送</button> </footer></form>
我設(shè)置頭像 .avatar 元素左浮動(dòng),然后設(shè)置 textarea 的 width=100%,但是這樣設(shè)置后 textarea 會(huì)新起一行,無法達(dá)到想要的效果。我想實(shí)現(xiàn)簡(jiǎn)書這樣的布局該怎么設(shè)置 css 樣式?
問題解答
回答1:= =題主不會(huì)照搬其樣式么?form設(shè)置relative,頭像設(shè)置absolute……
關(guān)鍵詞:絕對(duì)定位
.avatar { margin-right: -50px; float: left;}textarea { display: block; width: 100%; margin-left: 50px;}
以上按照你的思路來的,其實(shí)要實(shí)現(xiàn)這種分欄布局方法有很多種,BFC、absolute、flex 都可以。
回答3:<form action='' method='post'>
<p style='width:20%;float:left'> <a href='http://m.lshqa.cn/wenda/3430.html' class='avatar'><img src='http://m.lshqa.cn/wenda/images/avatar.jpg' alt=''></a></p><p style='width:80%;float:right'> <textarea placeholder='寫下你的評(píng)論...'></textarea> <footer><span>Ctrl + Return 發(fā)表</span><button type='reset'>取消</button><button type='submit'>發(fā)送</button> </footer></p>
</form>
回答4:代碼先寫4 后寫5
相關(guān)文章:
1. 求大神支招,php怎么操作在一個(gè)html文件的<head>標(biāo)記內(nèi)添加內(nèi)容?2. 安裝了“PHP工具箱”,但只能以“游客”身份登錄3. 老師們php,插入數(shù)據(jù)庫mysql,都是空的,要怎么解決4. 跨類調(diào)用后,找不到方法5. 在mybatis使用mysql的ON DUPLICATE KEY UPDATE語法實(shí)現(xiàn)存在即更新應(yīng)該使用哪個(gè)標(biāo)簽?6. 致命錯(cuò)誤: Class ’appfacadeTest’ not found7. 在應(yīng)用配置文件 app.php 中找不到’route_check_cache’配置項(xiàng)8. PHP類屬性聲明?9. 怎么php怎么通過數(shù)組顯示sql查詢結(jié)果呢,查詢結(jié)果有多條,如圖。10. phpstady在win10上運(yùn)行
