是否可以根据层次结构元素设置条件css?

时间:2016-07-18 03:51:49

标签: css

考虑以下HTML:

<div>
   <p>
     <strong>Title</strong>
   </p>
   <p>
     some resular text....
   </p>
</div>

我想在段落中添加填充,只要它有强大的&#39;在里面。

是否可以仅使用CSS(没有JS)?

2 个答案:

答案 0 :(得分:0)

是的,你会这样做:

p > strong {
    padding:10px;
}

答案 1 :(得分:0)

是的,你可以。请参阅https://jsfiddle.net/n05jaua4/3/了解规则。

演示:member function template

HTML:

$config['sess_expire_on_close'] = TRUE;
$config['sess_encrypt_cookie']  = FALSE;
$config['sess_use_database']    = TRUE;
$config['sess_table_name']      = 'ci_sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update']  = 300;

$config['cookie_prefix']    = "";
$config['cookie_domain']    = "";
$config['cookie_path']      = "/";
$config['cookie_secure']    = FALSE;

$config['global_xss_filtering'] = FALSE;

$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;

$config['time_reference'] = 'local';

CSS:

{ height : 100% !important; }