Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
301 views
in Technique[技术] by (71.8m points)

CSS positioning element with flexbox

style

I am trying to style the position something like the photo, I am using the flexbox to do that, but it seems not working as I expect. The first line was correct. My css, html are below: I need some professional comment please thanks

.box {
  display: flex,
  justify-content: space-around,
  flex: 1,
}
<div class="box">
  <span>Account: &nbsp;&nbsp; Payment Acceptance</span>
  <span>Division: Wireless Service Cen</span>
</div>
<div class="box">
  <p>Received by: ....</p>
</div>

<div class="box">
  <p>Reason: &nbsp;&nbsp;&nbsp; ....</p>
</div>

<div class="box">
  <p>Entered by: ....</p>
</div>
question from:https://stackoverflow.com/questions/65915277/css-positioning-element-with-flexbox

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

 .box {
  display: flex ; 
  flex: 1;
}
.box p{ 
  flex: 2;
}
 
<div class="box">
  <p>Account: &nbsp;&nbsp; Payment Acceptance</p>
  <p>Division: Wireless Service Cen</p>
</div>
<div class="box">
  <p>Received by: ....</p>
</div>

<div class="box">
  <p>Reason: &nbsp;&nbsp;&nbsp; ....</p>
</div>

<div class="box">
  <p>Entered by: ....</p>
</div>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...