Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 03, 2012 06:49 AM by roopeshreddy
Member
310 Points
340 Posts
Nov 28, 2012 06:48 PM|LINK
Hi, I am trying to style a div in JS but somehow text-decoration:none; isn't working, anyone knows what's the issue, thanks.:
boxText.innerHTML = '<div style="text-align:center; padding:15px; text-decoration:none; font-weight:bold;">' + '<a href="APage.aspx?aid=' + aid + '">' + name + '</a>' + '<p style=" margin-top:15px; margin-right:10px; border-bottom-style: solid; border-bottom-width: thin; border-bottom-color: #6F6F6F;"></p>' + '</div>';
Participant
815 Points
256 Posts
Nov 28, 2012 08:30 PM|LINK
boxText.innerHTML = '<div style="text-align:center; padding:15px; font-weight:bold;">' + '<a style="text-decoration:none;" href="APage.aspx?aid=' + aid + '">' + name + '</a>' + '<p style=" margin-top:15px; margin-right:10px; border-bottom-style: solid; border-bottom-width: thin; border-bottom-color: #6F6F6F;"></p>' + '</div>';
Did you try to style the anchor link already?
Star
14396 Points
2449 Posts
Nov 29, 2012 05:21 AM|LINK
Hi, You can try like this:
<div style="text-align:center; padding:15px; text-decoration:none; font-weight:bold;"> <a href="APage.aspx?aid=1" style="text-decoration:inherit;">test</a> </div>
but older IE versions have problem: http://www.w3schools.com/cssref/pr_text_text-decoration.aspso try dirctly applying on <a>
<a href="APage.aspx?aid=1" style="text-decoration:none;">test</a>
32 Points
11 Posts
Nov 30, 2012 10:43 AM|LINK
Hi ,
this is the right one
<a href="APage.aspx?aid=1" style="text-decoration:none;">test</a> because anchor tag never accepts the style what ever mentioned in the parent control.
Contributor
2662 Points
1040 Posts
Dec 02, 2012 03:09 PM|LINK
You should use the text decoration in the <a> tag because the text decoration you are using is for link not for the simple text in the div.
So this is gud
<a href="#" style="text-decoration: none;">Link</a>
This will set the link's text-decoration to none.
All-Star
20145 Points
3328 Posts
Dec 03, 2012 06:49 AM|LINK
Hi,
Yeah! text-decoration works for Anchor Tag(<a></a>)! So try that instead for DIV tag! Morover, it's semantically correct too!
Hope it helps u...
k80sg
Member
310 Points
340 Posts
innerHTML + text-decoration:none not working
Nov 28, 2012 06:48 PM|LINK
Hi, I am trying to style a div in JS but somehow text-decoration:none; isn't working, anyone knows what's the issue, thanks.:
boxText.innerHTML = '<div style="text-align:center; padding:15px; text-decoration:none; font-weight:bold;">' +
'<a href="APage.aspx?aid=' + aid + '">' + name + '</a>' +
'<p style=" margin-top:15px; margin-right:10px; border-bottom-style: solid; border-bottom-width: thin; border-bottom-color: #6F6F6F;"></p>' +
'</div>';
mebinici
Participant
815 Points
256 Posts
Re: innerHTML + text-decoration:none not working
Nov 28, 2012 08:30 PM|LINK
boxText.innerHTML = '<div style="text-align:center; padding:15px; font-weight:bold;">' + '<a style="text-decoration:none;" href="APage.aspx?aid=' + aid + '">' + name + '</a>' + '<p style=" margin-top:15px; margin-right:10px; border-bottom-style: solid; border-bottom-width: thin; border-bottom-color: #6F6F6F;"></p>' + '</div>';
Did you try to style the anchor link already?
Love collecting video games, movies and board games!
Enjoying my '11 WRX, so sexy...
raju dasa
Star
14396 Points
2449 Posts
Re: innerHTML + text-decoration:none not working
Nov 29, 2012 05:21 AM|LINK
Hi,
You can try like this:
<div style="text-align:center; padding:15px; text-decoration:none; font-weight:bold;"> <a href="APage.aspx?aid=1" style="text-decoration:inherit;">test</a> </div>but older IE versions have problem:
http://www.w3schools.com/cssref/pr_text_text-decoration.asp
so try dirctly applying on <a>
rajudasa.blogspot.com || blog@opera
parthi789
Member
32 Points
11 Posts
Re: innerHTML + text-decoration:none not working
Nov 30, 2012 10:43 AM|LINK
Hi ,
this is the right one
Afzaal.Ahmad...
Contributor
2662 Points
1040 Posts
Re: innerHTML + text-decoration:none not working
Dec 02, 2012 03:09 PM|LINK
You should use the text decoration in the <a> tag because the text decoration you are using is for link not for the simple text in the div.
So this is gud
This will set the link's text-decoration to none.
~~! FIREWALL !~~
roopeshreddy
All-Star
20145 Points
3328 Posts
Re: innerHTML + text-decoration:none not working
Dec 03, 2012 06:49 AM|LINK
Hi,
Yeah! text-decoration works for Anchor Tag(<a></a>)! So try that instead for DIV tag! Morover, it's semantically correct too!
Hope it helps u...
Roopesh Reddy C
Roopesh's Space