ฉันใช้ คุณสมบัติ CSS display
ที่มีค่า table
, table-row
และ table-cell
ในการจัดวาง เอกสารของฉันในรูปแบบตาราง
โดยปกติ (ดังที่คุณเห็นในโค้ด) ขนาดของเซลล์ในตารางจะสัมพันธ์กับเนื้อหาที่มี (จนกว่าเราจะระบุค่ามิติแบบฮาร์ดโค้ด
แต่ฉันต้องการให้ table-cell
ในวินาที (และอื่นๆ) table-row
มีความกว้างเท่ากับ table-cell
ที่สอดคล้องกันจาก table-row
แรก ดังนั้นความกว้างของ table-cell
แถวที่ 1 ในแถวที่สองจึงเหมือนกับ ความกว้างของ table-cell
อันที่ 1 ใน table-row
แรก เป็นไปได้ไหม?
ฉันต้องการทำสิ่งนี้โดยไม่ต้องเพิ่มคุณสมบัติ pixel
margin
หรือ padding
ฯลฯ ใน table-row
วินาทีและต่อมา ฉันแค่อยากให้มันได้ width
ของเซลล์ที่อยู่ด้านบน
ดังนั้นท้ายที่สุดแล้ว ความกว้างของคอลัมน์จะเท่ากับความกว้างของเซลล์ที่กว้างที่สุดในคอลัมน์
ฉันจะทำเช่นนั้นได้อย่างไร?
นี่คือซอ ในโค้ด แถวทั้งสามมีสีต่างกัน
รหัส:
<div style="display:table;">
<div style="background-color:#d9a4f4; display:table-row;">
<label style="display:table-cell; padding-left:10px; padding-right:10px;">Inferrable</label>
<label style="display:table-cell; padding-left:10px; padding-right:10px;">Not inferrable</label>
</div>
<div style="background-color:#7cbfdd; display:table-row;">
<input type="radio" name="radio_group1" value="0" style="display:table-cell;">
<input type="radio" name="radio_group1" value="0" style="display:table-cell;">
<label style="display:table-cell;">I am the label for the first group of radio buttons. I am the label for the first group of radio buttons. I am the label for the first group of radio buttons. I am the label for the first group of radio buttons. I am the label for the first group of radio buttons. </label>
</div>
<div style="background-color:#e8c277; display:table-row;">
<input type="radio" name="radio_group2" value="0" style="display:table-cell;">
<input type="radio" name="radio_group2" value="1" style="display:table-cell;">
<label style="display:table-cell;">I am the label for the second group of radio buttons. I am the label for the second group of radio buttons. I am the label for the second group of radio buttons. </label>
</div>
</div>
th
และscope
s สำหรับแถวแรก - person Pete   schedule 27.08.2014width
ที่ชัดเจนก็คือในแถวแรก บางครั้งจะมีคำที่เล็กเท่ากับ 'ใช่' และNo
เป็นป้ายกำกับ และบางครั้งinferrable
และNot inferrable
เช่น ถ้าฉันทำให้มันwidth:150px
โดยคำนึงถึงNot Inferrable
มันจะกว้างเกินไปสำหรับคำว่าNo
- person Solace   schedule 27.08.2014table-cell
ในtable-row
แรกมันจะแก้ปัญหาได้หรือไม่ - person Solace   schedule 27.08.2014