0
私はウェブサイトで作業しています。2枚のカードを同じ行に置くようにする
:.header {
text-align: center;
color: #ffffff;
font-family: Trebuchet MS;
}
body {
background: linear-gradient(to top right, #FFE259, #FFA751, #FFAF7B);
background-attachment: fixed;
}
.img {
text-align: center;
width: 50%;
height: 50%;
}
a:link {
text-decoration: none;
color: #0645AD;
}
a:visited {
text-decoration: none;
color: #0645AD;
}
a:active {
text-decoration: none;
color: #0B0080;
}
a:hover {
text-decoration: none;
color: #0B0080;
}
.cardPlain {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
transition: 0.3s;
border-radius: 10px;
width: 70%;
margin: auto;
}
.card:hover {
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
}
.container {
padding: 2px 16px;
width=70%;
margin: auto;
}
.control-width {
width: 70%;
margin: auto;
}
.card,
.control-width.card {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
transition: 0.3s;
border-radius: 10px;
margin: auto;
width: 100%;
}
<h1> </h1>
<div class="control-width">
<a href="bio.html">
<div class="card">
<p> </p>
<p style="text-align: center;"><img src="rappaticFull.jpg" alt="I haven't uploaded the image :-)"></p>
<div class="container" style="text-align:center">
<h2 class="header">Hi, I'm rappatic.</h2>
<p class="header">I code when I feel like it.</p>
<p> </p>
</div>
</div>
</a>
</div>
<h1> </h1>
<div class="cardPlain">
<div class="container" style="text-align:center">
<h3 class="header">My Stuff</h3>
<p class="header"><a href="https://stackexchange.com/users/7808413/pagie" target="_blank"> Stack Exchange</a></p>
<p class="header"><a href="downloads.html">Downloads</a></p>
<p class="header"><a href="https://github.com/rappatic" target="_blank">Github</a></p>
<p class="header"><a href="https://twitter.com/rappatic_" target="_blank">Twitter</a> | <a href="https://huggle.jdf2.org/hug/rappatic/" target="_blank">Huggles</a></p>
</div>
</div>
<div class="cardPlain">
<div class="container" style="text-align:center">
<h3 class="header">Foo</h3>
<p>bar</p>
<p>Some content</p>
(効果を得るために、出力のサイズを変更します)ので、アイデアは、このように、プレースホルダ(FOO)と同じ行に表示するには、ダウンロード用のdivを強制することです私が試した
すべてが(this、this、thisとthis)、実際には動作しません。私がdisplay: inline-block
のことをやろうとすると、左に2つのdivが表示されます。
2つのdivを同じ行に表示するにはどうすればよいですか?
これは差分になりますが、あなたは.container 'のタイプミス{...}'持っているかどうかわからない - あなたが持っている '幅= 70%;'等号を記号はコロンでなければなりません – ochi
''インラインブロック 'の試みが見えますか?両方が 'width:70%'(70 + 70> 100)に設定されていれば、1行に収まらないことに注意してください。また、2つの要素間の空白が表示され、幅に追加されることに注意してください.2つの幅が100%になる場合は、それらの間の空白を取り除く必要があります。 – showdev
また、 '.cardPlain'はあなたの画面の70%の幅を持っています...これは基本的に2つが1つの画面に横に並んでいないことを意味します – ochi