Looking to use pseudo elements to create a triangle

偶尔善良 提交于 2019-12-13 13:19:39

问题


I recently watched Chris Coyiers talk about pseudo elements and was looking to try and do the same.

I am looking to get the effect of an arrow pointing to the content on the right

This is the location of the li that I want to target

.overviews-list > li.active > ul.submenu > li.active

You can see from the jsfiddle the style I am going for. I think the css that needs to be changed is at the top of the css.

http://jsfiddle.net/T2HuD/1/


回答1:


This will set the positioning and create a down pointing arrow. The numbers are custom and can be adjusted to change the size of the arrow and its position.

.overviews-list > li.active > ul.submenu > li.active {
  position: relative;
}

.overviews-list > li.active > ul.submenu > li.active:after {
  position: absolute;
  content: "";
  width: 0px;
  height: 0px;
  border-top: 15px solid white;
  border-right: 15px solid transparent;
  border-bottom: 15px solid transparent;
  border-left: 15px solid transparent;
  top: 25%;
  right: 10px;
}

JS Fiddle




回答2:


I do this for something else but it should work for you too...

.pdfLink:before {
content:"\25BA";
color:#FF0000;
font-family: Arial,Helvetica,sans-serif;

}

All codes I have tried work. I can't recall how I came across that format for the char code, but the format is obvious if you check out this char description.



来源:https://stackoverflow.com/questions/19010044/looking-to-use-pseudo-elements-to-create-a-triangle

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!