前言 自从做了智慧城市这个项目之后,我一个做后端的开发者,瞬间转为前端开发,不过我还是很喜欢前端的。前端那些事,其实蛮有意思的,HTML实现的是静态的,使用ajax之后就可以和数据库交互了,加上js和jQuery之后就动起来了,加上CSS之后就更加炫酷了。因为项目中需要,查资料和编写了一些炫酷的二级菜单,分享给大家,好东西就要分享嘛!一、滑动菜单1、代码: View Code2、效果 二、左侧带图标多级下拉菜单1、HTML代码: V...
css3的强大,让人惊叹,人们在惊喜之余,又不得不为其艰难的道路感到可惜:好的标准只有得到行业浏览器的良好支持才算得上“标准”。CSS3标 准已提出数年,但是目前能实现她的浏览器并不多,虽然部分浏览器能实现部分规范,但这又有什么用呢?面对更多的兼容性问题,CSSer们只有望洋轻叹。虽 然如此,但有前瞻性的我们,又怎能停步不前呢?今天我们就来“前瞻”一下CSS3的一个伪类选择器“:nth-child()”。 语法: :nth-child(an+b...
1. 创建标签 document.createElement()2.$(tag).css(‘属性‘, 样式) 赋予标签属性样式3.设置定时器 改变位置 大小<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Title</title><style>.container{padding: 50px;border: 1px solid #eeeeee;}.item{cursor: pointer;position: relative;width: 30px;}</style></head><body><div class="container"><div class="item"><span>赞</span></div></div><div class=...
文本超出一定宽度让其隐藏,以省略号替代width:200px;
white-space:nowrap;
text-overflow:ellipsis;
overflow:hidden;如下图原文:https://www.cnblogs.com/theblogs/p/9941118.html
<style>
#talkbubble {
width: 120px;
height: 80px;
position: relative;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
border: 1px #808080 solid;
background-color: #fff;
} #talkbubble:before {
content: " ";
position: absolute;
top: 100%;
left: 50px;
width: 0;
height: 0;
border-left: 15px solid transparent;
border-to...
用过css样式我们就知道, 可以定义一批对象的class属性来指定同一个样式来统一界面. 但如何统一同类型的对象的事件? 比如:界面有无数个 <img src="**.jpg"> 如何实现鼠标经过此图片, 图片的src变成是**_over.jpg? 解决方法: 使用css的expression方法,具体实现要看看.css的写法:/*替换图片CSS*/ #imgScript{/*这里使用对象ID来通配样式,也可以定义一个css函数*/ star:expression( onmouseover=function() { /*替换图片*/ if(this.hov...
<strong><span style="font-size:12px;"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>MyHtml.html</title><meta http-equiv="keywords" content="keyword1,keyword2,keyword3"><meta http-equiv="description" content="this is my page"><meta http-equiv="content-type" content="text/html; charset=gb2312"><style type="text/css">*{margin:0px;padding:0px;}#web{width:1020px;hei...
<!DOCTYPE html>
<html><head><meta charset="utf-8" /><meta name="referrer" content="no-referrer"><title></title><style type="text/css">.zoom{width: 800px;height: 250px;display: flex;margin: 0 auto;}.left{width: 400px;height: 250px;background-image:url("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic1.win4000.com%2Fwallpaper%2F1%2F57bbdd4add0f3.jpg&refer=http%3A%2F%2Fpic1.win4000.com&app=2...
以前实现按钮一般都是用图片来实现的,特别是一些拥有质感的按钮,今天练习了一些相关方面的的例子,用css3来实现Social Media Buttons html代码如下 <div class="outset-colored"><ul><li> <a href=" " title="My E-Mail" class="email"> <img src="images/gmail_white.png" alt="gmail icon" /> <span class="site">E-Mail</span> </a> </li><li> <a href="#" title="My LinkedIn Page" class="linkedin"> <img src="images/link...
HTML/CSS方法实现下拉菜单来源:慕课网<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><title>无标题文档</title><style type="text/css">
*{ margin:0px; padding:0px;}/*清除所有默认格式*/#menu{ background-color:#eee;...
通过基础CSS实现输入提示交互动画效果,并兼容各浏览器!1.效果展示 2.css代码 h4 {margin: 30px 0;}input {margin: 0;font-size: 16px;line-height: 1.5;}.input-fill-x, .input-outline-x, .textarea-outline-x {position: relative;}.input-control:focus + label {color: red;background: white;transform: scale(0.8) translate(0, -17px);}.input-label {padding: 0 5px;position: absolute;left: 10px;top: 3px;tr...
1<!DOCTYPE html> 2<meta charset="UTF-8"/> 3<html> 4 5<head> 6<style> 7 div { 8 width: 100px; 9 height: 100px;10 background: red;11 position: relative;12 animation: myfirst 5s infinite alternate;13}1415 @keyframes myfirst {16 0% {
17 background: red;18 ...
1.伪元素+transform:translateX(-100%); 主要原理是设置文本居中text-align: center;,然后给定两个伪元素,分别绝对定位,那么此时伪元素也是跟随着水平居中的,设置足够的宽度,然后把左边的往左位移100%就可以了,父级记得超出隐藏。具体实现如下html结构为<div class="title">我是分割线</div>css样式为.title{position: relative;text-align: center;overflow: hidden;font-size: 14px;color: #999;
}
.title::before,.tit...
css做的一些图形。要先理解一个基础:css边框相接触的地方是45度平分空间的。#k{width: 20px;height: 30px;border: 40px solid;border-color: red green yellow blue;} 图形一: 1#talkbubble { 2 width: 120px; 3 height: 80px; 4 background: red; 5 position: relative; 6 } 7 #talkbubble:before { 8 content:"";9 position: absolute;
10 right: 100%;
11 top:...
一、文字选择的可用性 我们平时因为A原因或B原因,需要复制web页面上的文字内容。常见的操作就是按住鼠标,选中要复制的文字区域,抬起鼠标按键,目标区域的文字就选中了。不知你知不知道,有些看山去OK的CSS布局实际影响了页面上文字复制的可用性。这么说吧,假设你在微博上看见一个名为“屌丝逆袭”的标题,但是,由于孤陋寡闻,不知道这个标题啥意思,于是想百度之,最快的方式就是选择→复制→搜索。结果,像中了邪,这几个文字...