gpt4 book ai didi

html - 我如何修改我的四个象限以允许它们之间有一些 "breathing room"(HTML/CSS)?

转载 作者:太空宇宙 更新时间:2023-11-04 14:58:02 29 4
gpt4 key购买 nike

我已经能够根据已接受的答案在我的页面上创建四个大小/形状相同的象限 here .

所以页面现在看起来像这样:

enter image description here

我现在想给象限一些“肘部空间”——在它们的边缘周围一些空白。我尝试为他们使用的类添加边距:

.topleft {
background-color: blue;
margin: 4;
}
.topright {
background-color: red;
margin: 4;
}
.bottomleft {
background-color: green;
margin: 4;
}
.bottomright {
background-color: yellow;
margin: 4;
}

那什么也没做;我尝试添加填充:

.topleft {
background-color: blue;
padding: 4;
}
.topright {
background-color: red;
padding: 4;
}
.bottomleft {
background-color: green;
padding: 4;
}
.bottomright {
background-color: yellow;
padding: 4;
}

...那也什么也没做。

我需要做什么才能为所有人保留相同的 1/4 空间,但通过在它们之间添加边距或在它们周围填充来有效地“挤压”它们?

这是整个 html/css:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>eServices Customer Dashboard</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">

<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

<!-- Latest compiled JavaScript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

<!-- Inline CSS (don't tell the CSS-Whisperers I did this!) -->
<style>
body {
background-color: azure;
}
.body-content {
-webkit-box-shadow: -1px 0 5px 0 #000000;
-webkit-box-shadow: -1px 0 5px 0 rgba(0, 0, 0, .25);
box-shadow: -1px 0 5px 0 #000000;
box-shadow: -1px 0 5px 0 rgba(0, 0, 0, .5);
padding-left: 1px;
padding-right: 1px;
padding-bottom: 15px;
}
.jumbotronjr {
padding: 12px;
margin-bottom: -16px;
font-size: 21px;
font-weight: 200;
color: inherit;
background-color: white;
}
.addltopmargin {
margin-top: 8px;
}
.sectiontext {
font-size: 1.5em;
font-weight: bold;
font-family: Candara, Calibri, Cambria, serif;
}
.bottommarginbreathingroom {
margin-bottom: 2px;
}
.marginaboveandbelow {
margin-top: 15px;
margin-bottom: 15px;
}
.rightjustifytext {
text-align: right;
}
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}

td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}

tr:nth-child(even) {
background-color: #dddddd;
}
.contents{
height:50%;
width:100%;
}
redfont {
color: red;
}
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
.container {
width: 100vw;
height: 100vh;
display: flex;
flex-wrap: wrap;
}
.container div {
display: inline-block;
width: 50vw;
height: 50vh;
overflow-y: scroll;
}
.topleft {
background-color: blue;
padding: 4;
}
.topright {
background-color: red;
padding: 4;
}
.bottomleft {
background-color: green;
padding: 4;
}
.bottomright {
background-color: yellow;
padding: 4;
}
</style>
</head>

<body>

<div class="contents">
<div class="row">
<div class="col-md-6 topleft">
<h2>Top 10 Items Purchased</h2>
<div>
<input type="date" class="bottommarginbreathingroom" id="daterangefrom2" name="daterangefrom2">
</input>
<label> to </label>
<input type="date" class="bottommarginbreathingroom" id="daterangeto2" name="daterangeto2">
</input>
</div>

<table>
<tr>
<th>Item Code</th>
<th>Description</th>
<th>Qty</th>
</tr>

<tr>
<td>Item Code 1</td>
<td>Description 1</td>
<td>Qty 1</td>
</tr>
<tr>
<td>Item Code 2</td>
<td>Description 2</td>
<td>Qty 2</td>
</tr>
<tr>
<td>Item Code 3</td>
<td>Description 3</td>
<td>Qty 3</td>
</tr>
<tr>
<td>Item Code 4</td>
<td>Description 4</td>
<td>Qty 4</td>
</tr>
<tr>
<td>Item Code 5</td>
<td>Description 5</td>
<td>Qty 5</td>
</tr>
<tr>
<td>Item Code 6</td>
<td>Description 6</td>
<td>Qty 6</td>
</tr>
<tr>
<td>Item Code 7</td>
<td>Description 7</td>
<td>Qty 7</td>
</tr>
<tr>
<td>Item Code 8</td>
<td>Description 8</td>
<td>Qty 8</td>
</tr>
<tr>
<td>Item Code 9</td>
<td>Description 9</td>
<td>Qty 9</td>
</tr>
<tr>
<td>Item Code 10</td>
<td>Description 10</td>
<td>Qty 10</td>
</tr>
</table>
</div>

<div class="col-md-6 topright">
<h2>Pricing Exceptions - Weekly Recap</h2>
<h3 class="redfont">Red denotes Contract Item Overages</h3>
<h3>For Weyand on the pricing week of - 7/31/2016</h3>
<table>
<tr>
<th>Invoice No</th>
<th>Invoice Date</th>
<th>Customer</th>
<th>Cust #</th>
<th>Item Code</th>
<th>Description</th>
<th>Member Item Code</th>
<th>Member Description</th>
<th>Bid Price</th>
<th>Sell Price</th>
<th>Qty</th>
</tr>

<tr>
<td>Inv No 1</td>
<td>Inv Date 1</td>
<td>Customer 1</td>
<td>Cust # 1</td>
<td>Item Code 1</td>
<td>Descrip. 1</td>
<td>M.I. Code 1</td>
<td>Memb Desc 1</td>
<td>Bid Price 1</td>
<td>Sell Pr. 1</td>
<td>Qty 1</td>
</tr>
<tr>
<td>Inv No 2</td>
<td>Inv Date 2</td>
<td>Customer 2</td>
<td>Cust # 2</td>
<td>Item Code 2</td>
<td>Descrip. 2</td>
<td>M.I. Code 2</td>
<td>Memb Desc 2</td>
<td>Bid Price 2</td>
<td>Sell Pr. 2</td>
<td>Qty 2</td>
</tr>
<tr>
<td>Inv No 3</td>
<td>Inv Date 3</td>
<td>Customer 3</td>
<td>Cust # 3</td>
<td>Item Code 3</td>
<td>Descrip. 3</td>
<td>M.I. Code 3</td>
<td>Memb Desc 3</td>
<td>Bid Price 3</td>
<td>Sell Pr. 3</td>
<td>Qty 3</td>
</tr>
</table>
</div>
</div>

<div class="row">
<div class="col-md-6 bottomleft">
<h2>Forecasted Spend</h2>
<table>
<tr>
<th>Item</th>
<th>Last Week's Usage</th>
<th>This Week's Price</th>
<th>Forecasted Spend</th>
</tr>

<tr>
<td>Item 1</td>
<td>52</td>
<td>TWP 1</td>
<td>68.00</td>
</tr>
<tr>
<td>Item 2</td>
<td>49</td>
<td>TWP 2</td>
<td>65.00</td>
</tr>
<tr>
<td>Item 3</td>
<td>46</td>
<td>TWP 3</td>
<td>63.00</td>
</tr>
<tr>
<td>Item 4</td>
<td>42</td>
<td>TWP 4</td>
<td>60.00</td>
</tr>
<tr>
<td>Item 5</td>
<td>40</td>
<td>TWP 5</td>
<td>58.00</td>
</tr>
<tr>
<td>Item 6</td>
<td>42</td>
<td>TWP 6</td>
<td>60.00</td>
</tr>
<tr>
<td>Item 7</td>
<td>43</td>
<td>TWP 7</td>
<td>61.00</td>
</tr>
<tr>
<td>Item 8</td>
<td>43</td>
<td>TWP 8</td>
<td>61.00</td>
</tr>
<tr>
<td>TOTAL</td>
<td>314</td>
<td></td>
<td>$496.00</td>
</tr>
</table>
</div>

<div class="col-md-6 bottomright">
<h2>Fill Rate</h2>
<table>
<tr>
<th>Unit</th>
<th>Co. Name</th>
<th>Desc</th>
<th>Ord</th>
<th>Ship</th>
<th>Var</th>
</tr>

<tr>
<td>Unit 1</td>
<td>Co. Name 1</td>
<td>Desc 1</td>
<td>40</td>
<td>40</td>
<td>0</td>
</tr>
<tr>
<td>Unit 2</td>
<td>Co. Name 2</td>
<td>Desc 2</td>
<td>40</td>
<td>40</td>
<td>0</td>
</tr>
<tr>
<td>Unit 3</td>
<td>Co. Name 3</td>
<td>Desc 3</td>
<td>40</td>
<td>40</td>
<td>0</td>
</tr>
<tr>
<td>Unit 4</td>
<td>Co. Name 4</td>
<td>Desc 4</td>
<td>40</td>
<td>40</td>
<td>0</td>
</tr>
<tr>
<td>Unit 5</td>
<td>Co. Name 5</td>
<td>Desc 5</td>
<td>40</td>
<td>40</td>
<td>0</td>
</tr>
<tr>
<td>Unit 6</td>
<td>Co. Name 6</td>
<td>Desc 6</td>
<td>40</td>
<td>40</td>
<td>0</td>
</tr>
<tr>
<td>Unit 7</td>
<td>Co. Name 7</td>
<td>Desc 7</td>
<td>40</td>
<td>39</td>
<td>1</td>
</tr>
<tr>
<td>Unit 8</td>
<td>Co. Name 8</td>
<td>Desc 8</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>TOTAL</td>
<td></td>
<td></td>
<td>280</td>
<td>279</td>
<td>1</td>
</tr>
</table>
</div>
</div>


</div>
</body>
</html>

更新

添加填充只会使象限膨胀,不会在它们之间提供任何呼吸空间。它看起来或多或少好像为第一个元素分配了一个“顶部”属性,将其向下推。

添加边距 (16px) 会导致象限在页面上垂直排列 - 全部在左侧,右侧没有任何内容。这四个部分垂直堆叠,一个接一个。

最佳答案

marginpadding 都采用 CSS length 单位。有很多不同的单位,因为它们按绝对单位(像素或 px 是最常见的)或相对单位(emrem 是最常见的)。您也可以使用由百分比 % 给出的尺寸值,即使它不是长度值。

有关完整列表和深入解释,请参阅 here .

在您的情况下,padding 可能会帮助您解决问题,您可能希望使用比 4px 更大的值。

关于html - 我如何修改我的四个象限以允许它们之间有一些 "breathing room"(HTML/CSS)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38857740/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com