<dl> <dt>Name:</dt> <dd>zhanglu</dd> <dt>Email:</dt> <dd>zhanglu_helloworld@126.com</dd> <dd>zhanglu_helloworld@126.com</dd> <dt>Location:</dt> <dd>Earth</dd> </dl>
如何讓上面這一段HTML變成這個樣子:字體
dt,dd{ display: inline; } dd{ margin: 0; font-weight: bold; } dd + dt::before{ content: '\A'; /*除了第一行的dt以外,前面都換行*/ white-space: pre; /*防止空白符和換行符合並*/ } dd + dd::before{ content: ','; /*在除了第一個dd外的dd前加逗號*/ margin-left: -.25em; /*去掉每一個dd之間的空格,也就是逗號前的空格*/ font-weight: normal; }
padding: 0.5em; line-height: 1.5; background: beige; background-image: linear-gradient(transparent 50%, rgba(0,0,0,.2) 0); background-origin: content-box; /*很重要,讓條紋和文本行對應起來*/ background-size: auto 3em;
/*元素使用行內元素*/ background: linear-gradient(gray, gray) no-repeat; background-size: 100% 1px; background-position: 0 1.15em; text-shadow: .05em 0 white, -.05em 0 white;/*實現下劃線不穿過字體降部的效果*/
經過這樣方法,還能夠畫出虛線、波浪線等效果。spa
background: hsl(210,13%,60%); color: hsl(210, 13%, 30%); text-shadow: 0 1px 1px hsla(0,0%,100%,.8);
background: hsl(210,13%,30%); color: hsl(210, 13%, 60%); text-shadow: 0 -1px 1px black;
background: deeppink; color: white; text-shadow: 1px 1px black, 1px -1px black, -1px 1px black, -1px -1px black;
text-shadow: 0 0 1px black, 0 0 1px black, 0 0 1px black, 0 0 1px black, 0 0 1px black, 0 0 1px black;
text-shadow: 3px 3px black, 3px -3px black, -3px 3px black, -3px -3px black;
效果能夠說有點差了,因此不適合描邊寬的樣式。code
.glow{ background: #203; color: #ffc; transition: 1s; } .glow:hover{ text-shadow: 0 0 .1em , 0 0 .3em; }
.dizzy{ background: #203; color: #ffc; transition: 1s; } .dizzy:hover{ color: transparent; text-shadow: 0 0 .1em white , 0 0 .3em white; }
.dizzy{ background: #203; color: #ffc; transition: 1s; } .dizzy:hover{ filter: blur(.1em); }
background: steelblue; color: white; text-shadow: 0 1px hsl(0, 0%, 85%), 0 2px hsl(0, 0%, 80%), 0 3px hsl(0, 0%, 75%), 0 4px hsl(0, 0%, 70%), 0 5px hsl(0, 0%, 65%), 0 5px 10px black;
background: hsl(0, 50%, 45%); color: white; text-shadow: 1px 1px black, 2px 2px black, 3px 3px black, 4px 4px black, 5px 5px black, 6px 6px black, 7px 7px black, 8px 8px black;