相关疑难解决方法(0)

高级CSS挑战:仅使用CSS在最后一行文本下划线

我想强调多行文本的最后一行,或者至少创建它的暗示.仔细看下面的例子,因为我正在尝试做一些棘手的事情.

答:这就是我想要发生的事情(__标记文本应加下划线的位置):

A line of text that is long enough so that it wraps
to another line.
________________
Run Code Online (Sandbox Code Playgroud)

B.这是我不想要的:

A line of text that is long enough so that it wraps
___________________________________________________
to another line.
________________
Run Code Online (Sandbox Code Playgroud)

C.或者这个:

A line of text that is long enough so that it wraps
to another line.
___________________________________________________
Run Code Online (Sandbox Code Playgroud)

此效果适用于CMS,因此我不知道文本的确切长度.这意味着手动插入<span>s或<u>标签不是一种选择.我也不想用javascript.我很清楚我想要的效果不是默认行为,这需要一些棘手的CSS/HTML魔法.但我觉得这可能是可能的.如果您想不出办法,请不要费心提交答案.在你弄清楚如何去做之前,一切都是不可能的.

html css html5 css3

13
推荐指数
4
解决办法
4858
查看次数

将javascript计算样式从一个元素设置为另一个元素

所以我试图复制适用于一个元素的所有样式(class/id/tagName/attribute等).到目前为止,我发现我可以复制元素的计算样式,只有一个问题... couldend将它应用于其他元素; /

或diffrend复制所有样式的方法.

(这是我得到的:/) http://jsfiddle.net/8KdJd/2/

   //queriks mode + minor changes to retrive the computed style
function getCS(el)
{
    if (el.currentStyle)
        var y = el.currentStyle;
    else if (window.getComputedStyle)
        var y = document.defaultView.getComputedStyle(el,null);
    return y;
}
function setCS(el,cs)
{
    if (el.currentStyle)
    {

        el.currentStyle = cs;
        el.style = cs;
    }
    else if (window.getComputedStyle)
    {el.style = cs 
    }

}


var myLink = document.getElementById('myLink');
var anotherLink = document.getElementById('anotherLink');

var CS_myLink = getCS(myLink);
setCS(anotherLink,CS_myLink);
Run Code Online (Sandbox Code Playgroud)

javascript clone copy set computed-style

11
推荐指数
2
解决办法
9541
查看次数

标签 统计

clone ×1

computed-style ×1

copy ×1

css ×1

css3 ×1

html ×1

html5 ×1

javascript ×1

set ×1