亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

對象合并并忽略水平邊距、填充等

對象合并并忽略水平邊距、填充等

明月笑刀無情 2023-10-24 21:43:54
我編寫了一段應該顯示標題的小代碼。這些標題由 3 部分組成,中間是文本,左右各 2 行(圖 1)。如果我現在更改屏幕的寬度,對象就會相互結合(圖 2)。我希望它們能夠適應頁面的大小,并使線條和文本變小。僅計算機視圖。html {    height: 100%;    font-family: 'Montserrat' sans-serif;    display: grid;    align-items: center;    justify-items: center;/*---------------------------------------------------------------------------*//*---------------------------------------------------------------------------*/    --bg: #333333;    --bg-panel: #434343;    --color-headings: #3694FF;    --color-text: #ffffff;}html[data-theme='dark'] {    --bg: #FCFCFC;    --bg-panel: #EBEBEB;    --color-headings: #0077FF;    --color-text: #333333;}/*---------------------------------------------------------------------------*//*---------------------------------------------------------------------------*/a{text-transform: uppercase; text-decoration: none; font-weight: bold; font-size: 1.1em; font-family: 'Montserrat', sans-serif;}hr{width: 10%; height: 4px; background: var(--color-headings); border: 0; margin: 0;}h1, h2, h3, p, a, ul li{font-family: 'Montserrat', sans-serif; color: var(--color-text)}header{position: fixed; float: left; margin: 0; padding: 0; border: 0}body{background-color: var(--bg);}ul li{list-style-type: none;}h2{text-align: center}/*---------------------------------------------------------------------------*//*---------------------------------------------------------------------------*/.header{  margin-top: 5%;  width: 100%;}.header ul{  list-style-type: none;  margin: 0 auto 0 auto;  padding: 0;  width: 50%;  float: none;  border-left: 25%;  border-right: 25%;}.header ul li{  width: 32%;  float: left;  margin-bottom: 1%;  margin-left: 0.5%;  margin-right: 0.5%;  margin-top: 15%;}.header ul li hr{  width: 100%;  float: none;  margin: 0;  margin-left: auto;  margin-right: auto;  margin-top: 8%;  margin-bottom: 10%;}.header ul li h1{  margin: 0;  float: left;  margin-left: 10%;  margin-right: 10%;  width: 100%;}請幫助我,我不知道如何解決這個問題。提前致謝圖 1 圖 2
查看完整描述

2 回答

?
開滿天機

TA貢獻1786條經驗 獲得超13個贊

請嘗試這個。


h1{

  width: 60%; /* optional to control borders width */

  text-align: center;

  border-top: 4px solid #3694FF;

  margin: 20px auto -20px; /* -20px to compensate span shift */

}


h1 span{

  position: relative;

  top: -20px;

  padding: 0px 20px;

  display: inline-block;

  background: white;

}


h2{

  text-align: center;

}

<h1><span>Funktionen</span></h1>

<h2>Hier findest du eine übersicht der Funktionen des Programms</h2>


查看完整回答
反對 回復 2023-10-24
?
慕的地6264312

TA貢獻1817條經驗 獲得超6個贊

您可以使用 bootstrap 4 庫,它會自動處理所有場景。

這是鏈接 getbootstrap.com


查看完整回答
反對 回復 2023-10-24
  • 2 回答
  • 0 關注
  • 135 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號