带边框的方形 div。只显示角点[重复]

2023-11-27

我有一个在我的网站上使用的播放器。
我想更改播放按钮的外观。

我想用虚线边框来做到这一点,然后增加破折号之间的空间。那行不通。

我无法使用图像。有没有CSS(3)解决方案?

我希望它看起来像这样。

这真的都是关于角落的!

enter image description here

- - - - - - - 更新 - - - - - - - -

所以我使用了@Naila的解决方案来使其工作。 运行遇到以下问题:

I use Video.js插件WordPress我正在创建一个新皮肤

当我正在关注css我发现已经有一个::before-pseudo 处理播放箭头。

The ::before-伪箭头表示宽度为 100%,这有助于箭头位于中心。 因为我使用30%的宽度来使边框成为一个角。这会覆盖之前的 100% 宽度。结果如下:

enter image description here

这里是:
CodePen

如果你刚刚在 CSS 字段中跳过这个 CSS,你就会到达我现在所在的位置并看到问题:

/*
Player Skin Designer for Video.js
http://videojs.com

To customize the player skin edit 
the CSS below. Click "details" 
below to add comments or questions.
This file uses some SCSS. Learn more  
at http://sass-lang.com/guide)

This designer can be linked to at:
http://codepen.io/heff/pen/EarCt/left/?editors=010
*/

// The following are SCSS variables to automate some of the values.
// But don't feel limited by them. Change/replace whatever you want. 

// The color of icons, text, and the big play button border.
// Try changing to #0f0
$primary-foreground-color: #fff; // #fff default
// The default color of control backgrounds is mostly black but with a little
// bit of blue so it can still be seen on all-black video frames, which are c ommon.
// Try changing to #900
$primary-background-color: #2B333F;  // #2B333F default

// Try changing to true
$center-big-play-button: true; // true default

.video-js {
 /* The base font size controls the size of everything, not just text.
 All dimensions use em-based sizes so that the scale along with the font size.
 Try increasing it to 15px and see what happens. */
 font-size: 10px;

 /* The main font color changes the ICON COLORS as well as the text */
 color: $primary-foreground-color;
}

/* The "Big Play Button" is the play button that shows before the video plays.
To center it set the align values to center and middle. The typical location
of the button is the center, but there is trend towards moving it to a corner
where it gets out of the way of valuable content in the poster image.*/
.vjs-default-skin .vjs-big-play-button {
  /* The font size is what makes the big play button...big. 
 All width/height values use ems, which are a multiple of the font size.
 If the .video-js font-size is 10px, then 3em equals 30px.*/
 font-size: 3em;

 /* We're using SCSS vars here because the values are used in multiple places.
 Now that font size is set, the following em values will be a multiple of the
 new font size. If the font-size is 3em (30px), then setting any of
 the following values to 3em would equal 30px. 3 * font-size. */
 $big-play-width: 3em; 
  /* 1.5em = 45px default */
  $big-play-height: 3em;

 line-height: $big-play-height;
 height: $big-play-height;
 width: $big-play-width;

 /* 0.06666em = 2px default */
 /* 0.3em = 9px default */
 border:none;
 border-radius:0;

 @if $center-big-play-button {
 /* Align center */
left: 50%;
top: 50%;
margin-left: -($big-play-width / 2);
margin-top: -($big-play-height / 2);   
} @else {
/* Align top left. 0.5em = 15px default */
left: 0.5em;
top: 0.5em;
}
}
.vjs-big-play-button:before {
 position: absolute;
content: "";
width: 30px !important;
height: 30px!important;
right: -2px;
bottom: -2px;
 border-left: 2px solid $primary-foreground-color;
border-top: 2px solid $primary-foreground-color;
}
.vjs-big-play-button:after {
 position: absolute;
 content: "";
 width: 30px;
 height: 30px;
 right: -2px;
 bottom: -2px;
 border-right: 2px solid $primary-foreground-color;
 border-bottom: 2px solid $primary-foreground-color;
}

/* The default color of control backgrounds is mostly black but with a little
  bit of blue so it can still be seen on all-black video frames, which are     common. */
.video-js .vjs-control-bar,
.video-js .vjs-big-play-button,
.video-js .vjs-menu-button .vjs-menu-content {
  /* IE8 - has no alpha support */
  background-color: $primary-background-color;
  /* Opacity: 1.0 = 100%, 0.0 = 0% */
  background-color: rgba($primary-background-color, 0.7);
}

// Make a slightly lighter version of the main background
// for the slider background.
$slider-bg-color: lighten($primary-background-color, 33%);

/* Slider - used for Volume bar and Progress bar */
.video-js .vjs-slider {
 background-color: $slider-bg-color;
 background-color: rgba($slider-bg-color, 0.5);
}

/* The slider bar color is used for the progress bar and the volume bar
(the first two can be removed after a fix that's coming) */
.video-js .vjs-volume-level,
.video-js .vjs-play-progress,
.video-js .vjs-slider-bar {
background: $primary-foreground-color;
}

/* The main progress bar also has a bar that shows how much has been loaded.     */
.video-js .vjs-load-progress {
  /* For IE8 we'll lighten the color */
  background: lighten($slider-bg-color, 25%);
  /* Otherwise we'll rely on stacked opacities */
  background: rgba($slider-bg-color, 0.5);
}

/* The load progress bar also has internal divs that represent
 smaller disconnected loaded time ranges */
.video-js .vjs-load-progress div {
  /* For IE8 we'll lighten the color */
  background: lighten($slider-bg-color, 50%);
  /* Otherwise we'll rely on stacked opacities */
  background: rgba($slider-bg-color, 0.75);
}

我们可以这样做pseudo元素,查看演示

.box {
  width: 200px;
  height: 200px;
  margin: 15px auto;
  background: #999;
  position: relative;
}
.box:before {
  position: absolute;
  content: "";
  width: 30px;
  height: 30px;
  top: -2px;
  left: -2px;
  z-index:-1;
  border-left: 2px solid red;
  border-top: 2px solid red;
}
.box:after {
  position: absolute;
  content: "";
  width: 30px;
  height: 30px;
  right: -2px;
  bottom: -2px;
  z-index:-1;
  border-right: 2px solid red;
  border-bottom: 2px solid red;
}
<div class="box"></div>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

带边框的方形 div。只显示角点[重复] 的相关文章

  • 使用 CSS 创建互锁的不规则边框

    我有一个由 4 个 互锁 div 组成的布局 如下所示 我想在 顶部 和 底部 位周围放置边框 以使最终布局如下所示
  • Jquery,当屏幕宽度为1050px时删除类

    这是我正在使用的JS代码 document ready function var nav menu2 window scroll function if this scrollTop gt 90 nav addClass f nav els
  • 使用 div 代替 table 进行布局

    我想知道什么方法最好将表格布局替换为 div 我自己也尝试过一些 但它让我的 4x4 div 非常混乱 我猜当有经验做这样的事情时 这并不是很难完成 但我对 div 都是新手 并试图学习这一点 看看这个并分享您对表格是否应该保持原样或者是否
  • 这是浏览器错误吗?具有背景颜色的变量的继承

    我发现在css中的变量函数内声明时无法让背景颜色继承另一个元素的背景颜色 这是我遇到的一个例子 这是一个错误吗 div span border 1px solid black padding 10px margin 10px Backgro
  • Chrome - 儿童剪辑CSS3圆形边框?

    请参阅以下 JSFiddle http jsfiddle net zScKW http jsfiddle net zScKW 请注意 子 div 剪裁了其父 div 的边框 如果我删除边框 但保留圆角 该项目将按照我们的预期进行剪辑 Fir
  • 为什么 Bootstrap 按钮下拉菜单在 iOS 上不起作用?

    看起来甚至连引导演示在这里 http twitter github com bootstrap components html buttonDropdowns不适用于 iOS 您似乎无法在 iPhone 或 iPad 上从中选择项目 有解决
  • 可以在 iPad 上自动播放 HTML5 视频吗?

    The
  • 不显示 ul 中的项目符号 [重复]

    这个问题在这里已经有答案了 我在 ul 中显示项目符号时遇到问题 有谁知道问题出在哪里 my site http www minikoblizky wz cz zamestnanci html它以 Co od v s o ek v me 开
  • xsl 方法中的自关闭标签:xml

    我正在使用一个使用 xsl method xml 创建 html 模板的网站 但是 当 xsl 引擎呈现 html 页面时 我遇到了标签自动关闭的问题 div div 转换为 gt div div 该方法需要保留 xml 否则页面的其他组件
  • Firefox 浮动错误?如何让我的 float:right 在同一条线上?

    我有以下小提琴 http jsfiddle net q05n5v4c 2 http jsfiddle net q05n5v4c 2 在 Chrome 中 它渲染得很好 V 形标志位于右侧 然而 在 Firefox 中 Chevron 字形下
  • 如何获取div背景图像上的锚标记?

    HTML div a href http www facebook com au a div css facey float left width 32px height 32px background url file C Users U
  • 使用 c out 标签时不会出现新行

    我将 n 附加到字符串中 当使用 s 标签文本区域时 已附加换行符并且数据逐行显示 但是当我使用 c out 标签时 数据显示在一行中 如何使用 c out 标签逐行显示 StringBuffer sb new StringBuffer f
  • 带搜索框的 D3 图表

    我在 D3 中创建了一个图表 其中节点显示特定个人创建文档的时间 该图表还显示了一个搜索框 该搜索框根据搜索框输入是否与与该文档关联的单词匹配而将节点变成红色 这些单词列在数据集的第 5 列中 请参阅下面的数据集 我的问题 一旦将搜索输入到
  • ag-Grid 中的行格式

    我们需要有条件地将行文本设置为粗体 目前它仅适用于单个单元格 但我们需要在所有列单元格上应用文本粗体 应用格式设置后 isBold 列必须隐藏 删除 此列仅用于格式化 如何应用文本缩进 10px isBold 列包含真实值的第一列的 有可能
  • CSS 文本渐变

    我环顾四周 找不到任何与此相关的信息 如果我有一段文本 有没有办法 也许使用 CSS3 来逐渐改变文本的颜色 因为它下降到页面 而不是渐变的方式 因为这只对单词起作用 而不是对整个文本段落起作用 所以我希望一些文本从白色开始 然后在到达段落
  • 删除 twitter bootstrap 中的行

    我正在使用 twitter bootstrap 来执行一些我被迫执行的网络应用程序 我不是网络开发人员 但我找不到一种方法来禁用表的行线 正如你可以看到引导文档 http getbootstrap com components panels
  • 样式选项标签[重复]

    这个问题在这里已经有答案了 我有一个包含选项的下拉菜单 我想部分地打破和粗体一些文本以及插入上下文中断 我尝试使用 CSS 和 HTML 标签 但无法得到它 有人可以建议一个解决方案吗 提前致谢 我知道这个问题有点老了 或者至少不是新的 但
  • Chrome 开发工具准确计算 CSS 规则值

    无论如何 例如我可以获取要在 Chrome 开发工具中显示的字体的确切像素值 带小数位 吗 In Firebug 如下 当我定义 value 它显示精确的计算值 以像素为单位 最多 4 位小数 In Chrome 开发工具 如下 它仅显示整
  • 将画布下载为 PNG 图像[重复]

    这个问题在这里已经有答案了 当我尝试将画布下载为 PNG 图像时 浏览器会在新页面中打开该图像 但不下载它 我的下载代码 btnScaricaEtichetta click function console log Download loc
  • 表格单元格中 ::after 上的位置在 Firefox 中不起作用?

    以下代码应创建一个跨越其父元素宽度 100 的伪元素 然而 这在 Firefox 中不起作用 但在 Chrome 中却有效 火狐浏览器似乎忽略了 parent s position relative 这是一个错误吗 HTML div cla

随机推荐

  • TextView 中的 ImageSpan 对齐

    我有一个TextView它利用了android lineSpacingMultiplier属性来增加行之间的间距 除了当我添加一个ImageSpan到正文 这会导致图像与行之间的空间底部对齐 而不是文本的基线 如我创建文本时指定的那样 我尝
  • 如何仅使用扩展名打开文件?

    我有一个 Python 脚本 它打开位于具体目录 工作目录 并执行一些操作 假设如果目录中有一个文本文件 那么它总是不超过一个这样的 txt file with open TextFileName txt r as f for line i
  • Objective-C 泛型不适用于方法? (Xcode 7 Beta(内部版本:7A120f))

    所以 显然 在 WWDC 之后 我正在尝试上周推出的新内容 如您所知 Apple 将泛型引入了 Objective C 世界 注意 这个答案在某种程度上是这个问题的后续 Objective C 中有强类型集合吗 我在方法中尝试了这段代码 效
  • 当用户单击正确的目标应用程序时,如何关闭 ACTION_USAGE_ACCESS_SETTINGS 意图?

    我正在使用意图ACTION USAGE ACCESS SETTINGS在设置 Settings gt Security gt Apps with usage access 使用UsageStatsManager在棒棒糖版本中 public
  • 滚动条出现时css伪元素(tr外的三角形)位置未对齐

    我有一个高度固定的面板overflow y auto 在此面板中 我正在显示表格 当用户单击其中一行时 行右侧会出现三角形 该三角形工作正常 直到滚动条不出现在表格列表中 如果有滚动条 则面板下方会出现右箭头 如何解决这个问题 Here i
  • 根据请求更改 OWIN Auth 中间件(多租户,每个租户的 oauth API 密钥)

    我有一个多租户应用程序 每个租户都可以使用 OAUTH 2 通过 Facebook Twitter Google 等对其用户进行身份验证 每个租户都有自己的用于上述服务的 API 密钥 设置 OWIN 管道的典型方法是在启动中 使用 身份验
  • symfony2 中不存在变量

    我的 symfony2 项目遇到以下问题 这是我的控制器的代码 public function showCustomerAction id retrieve the customer from the database em this gt
  • 如何删除SASS字符串中的空格?

    SASS 中是否有一个字符串函数可以删除字符串中的空格 例如 我想使用变量 带空格的字符串 来指定资源图像文件 不带空格的名称 就像是 str var The White Lion mixin bg img name background
  • 从 post-receive 挂钩更新 Git 子模块

    我正在尝试自动更新我的子模块位于var www php vendor projectX在每次提交时var www超级项目 我在中添加了这些行 git hooks post receive file bin sh echo Updating
  • 如何将 JSF 组件居中对齐

    在我的 JSF 2 Primefaces 3 Web 应用程序中 我使用
  • Swift Playground 中的 CABasicAnimation

    一直在疯狂地尝试在 Swift Playground 中实时查看动画 就像 WWDC Swift Playgrounds 视频中那样 我尝试做一个UIView animateWithDuration运气不好 所以我现在尝试做一个 CABas
  • extjs 4.2 中的文件上传无需 form.submit()

    我正在尝试在 extjs 中上传文件 截至目前任何扩展名 我有一个模型和商店 文件上传是从窗口中进行的 而窗口中没有表单 我在网上尝试过的所有示例都是使用 form submit 的 我改为使用 Ajax 调用 如下所示 将数据发送到服务器
  • 删除单词之间的重复字符

    我正在尝试以下测验正则表达式101 任务 6 中的问题是 不好了 昨晚我的朋友们似乎把啤酒洒在了我的键盘上 现在我的按键变得非常粘 有时 当我按下一个键时 我会得到两个重复的值 你能p吗ppllleaaaseee帮我解决这个问题吗 粗体内容
  • 如何在 Tkinter 中反转导入图像的 y 轴?

    对于重复标记 我完全知道有一些类似的问题matplotlib 例如this one 我的问题是about Tkinter not matplotlib 我现在将 Lena 导入 python 并在她的帽子上画一个绿点 In 72 from
  • D3 - 大型 GeoJSON 文件无法使用投影正确显示绘制地图

    我在绘制从 data seattle gov 获取的 GeoJSON 文件时遇到问题 具体来说 我正在使用可以找到的形状文件here 我将其转换为 GeoJSON 文件 我在下面提供了一个小示例 通过使用 D3 我希望画出西雅图的不同区域
  • 对于主要包含阿拉伯文本的网页,我应该使用什么字符编码? utf-8可以吗?

    对于主要包含阿拉伯文本的网页 我应该使用什么字符编码 utf 8可以吗 UTF 8 可以存储完整的 Unicode 范围 因此适合用于阿拉伯语 但是 如果您想知道哪种编码最有效 所有阿拉伯字符都可以使用单个 UTF 16 代码单元 2 个字
  • 找不到满足要求的版本

    我使用以下命令在 Ubuntu 12 04 中安装多个 Python 包requirements txt file numpy gt 1 8 2 lt 2 0 0 matplotlib gt 1 3 1 lt 2 0 0 scipy gt
  • 倒数计时器取消()不工作

    我是 Android 开发新手 正在尝试制作小游戏 CountDownTimer cancel 不适合我 任何想法 谢谢您的回答 CountDownTimer cdt new CountDownTimer 120000 1000 publi
  • MVVM WPF 中的错误窗口显示模态

    我已将 MVVM 错误消息实现为消息对话框 通过中介类订阅错误消息 以便其他视图模型可以在发生任何错误时通知它 当发生错误时 我将视图模型中的可见性属性设置为Visible 以显示错误窗口 这全部绑定在视图模型的错误窗口中 然而 这个窗口不
  • 带边框的方形 div。只显示角点[重复]

    这个问题在这里已经有答案了 我有一个在我的网站上使用的播放器 我想更改播放按钮的外观 我想用虚线边框来做到这一点 然后增加破折号之间的空间 那行不通 我无法使用图像 有没有CSS 3 解决方案 我希望它看起来像这样 这真的都是关于角落的 更