Tech Support Forum banner

Subscript in HTML

2823 Views 11 Replies 4 Participants Last post by  Laxer
Hi,

I would like to know, is there any way to control "subscript" in HTML.

I would like to add a subscript(<sub>) to heading(<h1>) but would like to change its font & color etc.

<html>
<body style="background-color:lightGreen;">
<h1 style="font-family:Chiller;color:Red;font-size:80px;text-align:center">Mylapally Ravi Kumar<sub style="font-family:veranda;color:blue;font-size:20px>Neene Raju</sub></h1>
<hr />

<img src="https://lh4.googleusercontent.com/_qFTL5hCj8g0/TXfgGSADISI/AAAAAAAAEyA/lSAFVJpFBE4/IMG0159A.jpg"
</body>
</html>

I tried this way but never worked!

Thanks,
Fareed
Status
Not open for further replies.
1 - 12 of 12 Posts
Can't say i have ever used a sub.

perhaps a span would work, personally i would make it an h1 and an h3...
Re: Subscript in HTML (Solved)

Thanks a ton,

But I got the solution, All we need to do is to us "HTML Class Attribute".

<html>
<head>
<style type="text/css">
sub.fame {color:#0000ff;font-family:chiller;font-size:50px}
</style>
</head>

<body style="background-color:lightGreen;">
<h1 style="font-family:Chiller;color:Red;font-size:100px;text-align:center">Mylapally Ravi Kumar<sub class="fame">Neene Raju</h1>
<hr />
<img src="https://lh4.googleusercontent.com/_qFTL5hCj8g0/TXfgGSADISI/AAAAAAAAEyA/lSAFVJpFBE4/IMG0159A.jpg"
</body>
</html>

Thanks,
Fareed.
See less See more
Remember to close your tags :D

Personally i would have done:

HTML:
<html>
<head>
<style type="text/css">
.fame {color:#0000ff;font-family:chiller;font-size:50px}
</style>
</head>

<body style="background-color:lightGreen;">
<h1 style="font-family:Chiller;color:Red;font-size:100px;text-align:center">Mylapally Ravi Kumar<span class="fame">Neene Raju</span></h1>
<hr />
<img src="https://lh4.googleusercontent.com/_qFTL5hCj8g0/TXfgGSADISI/AAAAAAAAEyA/lSAFVJpFBE4/IMG0159A.jpg"
</body>
</html>
See less See more
Hi,

I'm afraid that u never used subscript!

Thanks,
Fareed
Hello mate this is very nice thread. Thanks for sharing such nice information. Take care.
I know you've already figured a way around the issue, but I feel obligated to let you know what your problem was. The need for a class attribute doesn't exist. Only one thing kept you from having it work, you never put a closing " for the style attribute of the <sub> tag. In essence, everything after the start of the style attribute was considered part of it, until the first quote of the src attribute of the <img> tag. That didn't show up simply because you hadn't properly closed it either.

Here's what your original could would've been:
HTML:
<html>
 <body style="background-color:lightGreen;">
  <h1 style="font-family:Chiller;color:Red;font-size:80px;text-align:center">Mylapally Ravi Kumar<sub style="font-family:veranda;color:blue;font-size:20px;">Neene Raju</sub></h1>
  <hr />
  <img src="https://lh4.googleusercontent.com/_qFTL5hCj8g0/TXfgGSADISI/AAAAAAAAEyA/lSAFVJpFBE4/IMG0159A.jpg">
 </body>
</html>
I hope this helps. Just keep an eye open in the code where a problem appears for something not written properly. ^^
Thought i would jump in one last time.

I will apologize ahead of time as a didn't quite understand that by subscript you actually wanted subscript....

anyway here is my solution:

HTML:
<html>
<head>
<style type="text/css">
h1{
font-family:Chiller;
color:Red;
font-size:100px;
text-align:center
}
h1 sub {
color:#0000ff;
font-family:chiller;
font-size:50px;
}
</style>
</head>

<body style="background-color:lightGreen;">
<h1>Mylapally Ravi Kumar<sub>Neene Raju</sub></h1>
<hr />
<img src="https://lh4.googleusercontent.com/_qFTL5hCj8g0/TXfgGSADISI/AAAAAAAAEyA/lSAFVJpFBE4/IMG0159A.jpg" alt="This is an Image"/>
</body>
</html>
See less See more
@DDAoN
Excellent dude!

I tried it earlier but there was a mistake(Check the original post) thus i went for class. And now I'm glad that i do not need to use class.

Thanks,
Fareed
I'm glad that TSF is a good platform for doubts & solutions.

I appreciate your zeal to spread the knowledge.

Laxer rocks! DDAoN Rocks!! TSF Rocks!!!!!

Lets close this here.

Thought i would jump in one last time.

I will apologize ahead of time as a didn't quite understand that by subscript you actually wanted subscript....

anyway here is my solution:

HTML:
<html>
<head>
<style type="text/css">
h1{
font-family:Chiller;
color:Red;
font-size:100px;
text-align:center
}
h1 sub {
color:#0000ff;
font-family:chiller;
font-size:50px;
}
</style>
</head>

<body style="background-color:lightGreen;">
<h1>Mylapally Ravi Kumar<sub>Neene Raju</sub></h1>
<hr />
<img src="https://lh4.googleusercontent.com/_qFTL5hCj8g0/TXfgGSADISI/AAAAAAAAEyA/lSAFVJpFBE4/IMG0159A.jpg" alt="This is an Image"/>
</body>
</html>
lol, I'm not a big fan of CSS, imbedded or otherwise. However, with websites as complex as I program, I'm glad it even exists, and I'm glad I could help.

As you develop your programming knowledge you'll come to appreciate the benefits of CSS and the attributes in a tag commonly associated with it. ^^
lol, I'm not a big fan of CSS, imbedded or otherwise. However, with websites as complex as I program, I'm glad it even exists, and I'm glad I could help.

As you develop your programming knowledge you'll come to appreciate the benefits of CSS and the attributes in a tag commonly associated with it. ^^
I manage a 1000+ page website for my school.... without css i would be... :4-thatsba

Anyway always glad to help, please post another thread if you need anymore help.
1 - 12 of 12 Posts
Status
Not open for further replies.
Top