Tech Support Forum banner
Status
Not open for further replies.
1 - 12 of 12 Posts

·
Registered
Joined
·
11 Posts
Discussion Starter · #1 ·
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
 

·
Registered
Joined
·
11 Posts
Discussion Starter · #3 ·
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.
 

·
Registered
Joined
·
5,202 Posts
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>
 

·
Design Team
Joined
·
433 Posts
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. ^^
 

·
Registered
Joined
·
5,202 Posts
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>
 

·
Registered
Joined
·
11 Posts
Discussion Starter · #10 ·
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>
 

·
Design Team
Joined
·
433 Posts
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. ^^
 

·
Registered
Joined
·
5,202 Posts
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