您的位置:

boxshadow四个边阴影的使用方法

一、基本使用方法

.box {
   box-shadow: 10px 10px 10px 10px rgba(0, 0, 0, 0.5);
}

box-shadow属性接受四个值:水平偏移量、垂直偏移量、模糊半径和阴影扩展半径。rgba指定了颜色和透明度。

如果水平偏移量为正值,则阴影会在盒子的右边,如果为负值,则阴影会在左边。垂直偏移量和水平偏移量类似。

模糊半径控制了阴影的模糊程度。较大的值会让阴影看起来更柔和、更自然。阴影扩展半径控制了阴影的大小。较大的值会让阴影范围更广。

二、多重阴影的使用方法

.box {
   box-shadow: 10px 10px 10px 10px rgba(0, 0, 0, 0.5),
               -10px -10px 10px 10px rgba(255, 255, 255, 0.5);
}

box-shadow属性可以同时接受多个参数,用逗号分隔可以设置多重阴影。

上面的例子中,盒子有两个阴影,一个是向右下的黑色阴影,另一个是向左上的白色阴影。

三、不规则阴影的使用方法

.box {
  box-shadow: inset 0px 0px 0px 30px rgba(0,0,0,0.5);
}

box-shadow属性还可以通过关键字" inset "创建内阴影。

上面的例子中,盒子内部有一圈30像素宽的内阴影。这种效果常常用在按钮按下后,使其看起来更具立体感的效果上。

四、阴影效果的应用

阴影效果可以为元素添加层次感和立体感,加强了元素的视觉效果。

阴影效果在UI设计中也常被用于菜单、按钮和卡片等元素的设计上。下面是一个例子:

.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 5px;
  color: #fff;
  background-color: #4CAF50;
  font-size: 16px;
  box-shadow: 2px 2px 2px 2px rgba(0, 0, 0, 0.3);
}

这个按钮的背景色是#4CAF50,字体颜色为白色。阴影效果为2像素大小的黑色阴影,使按钮看起来更有立体感。

五、小结

通过box-shadow属性,可以为元素添加阴影效果,创建出层次感和立体感,使UI设计更具有视觉吸引力。

使用多重阴影、不规则阴影以及调整模糊半径和扩展半径等属性,可以创造出更多的阴影效果。

详解boxshadow内部阴影的多种应用

2023-05-19
boxshadow四个边阴影的使用方法

2023-05-21
1. boxshadow默认值

2023-12-08
java边框阴影,段落边框阴影

2022-11-18
cad如何做阴影,cad怎么做阴影

2022-11-27
cad如何标阴影,cad怎么表示阴影

2023-01-06
cad家具阴影,cad阴影怎么画

2022-12-01
cad怎么打阴影,cad中怎么打阴影

2022-11-26
弱电图纸中阴影怎么画,弱电图纸中阴影怎么画出来

2023-01-03
cad阴影分析画图,cad制图阴影怎么画

2023-01-07
su边线投射使用,su投影线条

2022-11-30
cad在面积区域内上阴影,cad里面积不显示阴影

2022-11-26
关于python单一背景阴影去除的信息

2022-11-17
去掉input边框及阴影

2023-05-09
CSS边框笔记

2023-05-12
java方法整理笔记(java总结)

2022-11-08
when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${item.id} [in template "article/detail/index.ftl" at line 48, column 106] ---- Java stack trace (for programmers): ---- freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...] at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134) at freemarker.core.EvalUtil.coerceModelToTextualCommon(EvalUtil.java:481) at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:401) at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:370) at freemarker.core.DollarVariable.calculateInterpolatedStringOrMarkup(DollarVariable.java:104) at freemarker.core.DollarVariable.accept(DollarVariable.java:63) at freemarker.core.Environment.visit(Environment.java:371) at freemarker.core.IteratorBlock$IterationContext.executedNestedContentForCollOrSeqListing(IteratorBlock.java:321) at freemarker.core.IteratorBlock$IterationContext.executeNestedContent(IteratorBlock.java:271) at freemarker.core.IteratorBlock$IterationContext.accept(IteratorBlock.java:244) at freemarker.core.Environment.visitIteratorBlock(Environment.java:645) at freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:108) at freemarker.core.IteratorBlock.accept(IteratorBlock.java:94) at freemarker.core.Environment.visit(Environment.java:335) at freemarker.core.Environment.visit(Environment.java:341) at freemarker.core.Environment.visit(Environment.java:341) at freemarker.core.Environment.process(Environment.java:314) at freemarker.template.Template.process(Template.java:383) at org.springframework.web.servlet.view.freemarker.FreeMarkerView.processTemplate(FreeMarkerView.java:332) at org.springframework.web.servlet.view.freemarker.FreeMarkerView.doRender(FreeMarkerView.java:266) at org.springframework.web.servlet.view.freemarker.FreeMarkerView.renderMergedTemplateModel(FreeMarkerView.java:220) at org.springframework.web.servlet.view.AbstractTemplateView.renderMergedOutputModel(AbstractTemplateView.java:181) at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:314) at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1431) at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1167) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1106) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:903) at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:564) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885) at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:205) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) at com.software.filter.HttpSpiderIdentifyFilter.doFilter(HttpSpiderIdentifyFilter.java:51) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:340) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:391) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:896) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1744) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) at java.base/java.lang.VirtualThread.run(VirtualThread.java:309)