我需要在flexbox容器中的所有元素彼此靠近。不幸的是,由于它们具有不同的字体大小,因此很难做到。我可以使用边距来修复它,但这似乎是一种不明智的方法。
#price {
font-weight: bold;
border: none;
font-size: 1.5em;
}
#currency {
color: #000000;
font-size: 1.5em;
font-weight: bold;
}
#price:focus {
outline: none;
}
#price-info {
display: flex;
align-items: flex-start;
}
<div id="price-info">
<p id="currency">U$S</p><input id="price" type="text" value={this.state.price} onChange={this.handleChange} />
<p>$/m2{sizePrice}</p>
</div>
答案 0 :(得分:1)
#price{
font-weight: bold;
border:none;
font-size: 1.5em;
}
#currency{
color:#000000;
font-size: 1.5em;
font-weight: bold;
}
#price:focus {
outline:none;
}
#price-info{
display: flex;
justify-content: center;
align-items: baseline
}
<div id="price-info">
<p id="currency">U$S</p><input id="price" type="text" value={this.state.price} onChange={this.handleChange} />
<p>$/m2{sizePrice}</p>
</div>
这是您正在寻找的可能解决方案。
您可以使用justify-content
来水平放置元素。
我相信您可以通过align-items
属性来实现。
答案 1 :(得分:0)
尝试一下。但是要手动设置边距并不是一件容易的事
<table id="myTable">
<tr>
<td>1</td>
<td></td>
<td></td>
<td>4</td>
<td>8</td>
<td>9</td>
<td></td>
<td></td>
<td>6</td>
</tr>
<tr>
<td>7</td>
<td>3</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>4</td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>1</td>
<td>2</td>
<td>9</td>
<td>5</td>
</tr>
<tr>
<td></td>
<td></td>
<td>7</td>
<td>1</td>
<td>2</td>
<td></td>
<td>6</td>
<td></td>
<td></td>
</tr>
<tr>
<td>5</td>
<td></td>
<td></td>
<td>7</td>
<td></td>
<td>3</td>
<td></td>
<td></td>
<td>8</td>
</tr>
<tr>
<td></td>
<td></td>
<td>6</td>
<td></td>
<td>9</td>
<td>5</td>
<td>7</td>
<td></td>
<td></td>
</tr>
<tr>
<td>9</td>
<td>1</td>
<td>4</td>
<td>6</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td>2</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>3</td>
<td>7</td>
</tr>
<tr>
<td>8</td>
<td></td>
<td></td>
<td>5</td>
<td>1</td>
<td>2</td>
<td></td>
<td></td>
<td>4</td>
</tr>
function wpse_291143_generate_taxonomy_rewrite_rules( $wp_rewrite ) {
global $wp_rewrite;
$base = "shop";
$rules = array();
$terms = get_terms( array( 'taxonomy' => 'product_cat', 'hide_empty' => false ));
foreach($terms as $term) {
$term_children = get_terms( array(
'taxonomy' => 'product_cat',
'parent' => intval($term->term_id),
'hide_empty' => false
)
);
if($term_children) {
foreach ( $term_children as $term_child ) {
$rules[$base . '/' . $term->slug . '/' . $term_child->slug . '/?$'] = 'index.php?product_cat=' . $term_child->slug;
}
}
}
$wp_rewrite->rules = $rules + $wp_rewrite->rules;
return $wp_rewrite->rules;
}
add_action('generate_rewrite_rules', 'wpse_291143_generate_taxonomy_rewrite_rules');