我想强调多行文本的最后一行,或者至少创建它的暗示.仔细看下面的例子,因为我正在尝试做一些棘手的事情.
答:这就是我想要发生的事情(__标记文本应加下划线的位置):
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魔法.但我觉得这可能是可能的.如果您想不出办法,请不要费心提交答案.在你弄清楚如何去做之前,一切都是不可能的.
所以我试图复制适用于一个元素的所有样式(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)