将box-shadow添加到非矩形形状的div(使用border-radius)

时间:2016-09-15 13:37:50

标签: html css border shadow box-shadow

是否可以为不是常规矩形的div添加偶数阴影?添加box-shadow并不像普通div那样工作。这就是我所说的:

<?php 

    // These variables define the connection information for your MySQL database 
    $username = "root"; 
    $password = "root"; 
    $host = "localhost"; 
    $dbname = "4tickets"; 

    $options = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'); 
    try { $db = new PDO("mysql:host={$host};dbname={$dbname};charset=utf8", $username, $password, $options); } 
    catch(PDOException $ex){ die("Failed to connect to the database: " . $ex->getMessage());} 
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 
    $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); 
    header('Content-Type: text/html; charset=utf-8'); 
    session_start(); 
?>

1 个答案:

答案 0 :(得分:0)

是的,你可以。这是一个例子:

.circle { 
width:150px;
height:150px; 
border: solid 1px #555;
background-color: #eed; 
box-shadow: 10px -10px rgba(0,0,0,0.6); 
-moz-box-shadow: 10px -10px rgba(0,0,0,0.6); 
-webkit-box-shadow: 10px -10px rgba(0,0,0,0.6); 
-o-box-shadow: 10px -10px rgba(0,0,0,0.6); 
border-radius:100px; 
}
<div class="circle">

</div>