?
Solved

Capitalize the the title tag of an image

Posted on 2010-09-03
7
Medium Priority
?
454 Views
Last Modified: 2012-05-10
Can straight css capitalize the the title tag of an image?If so, how?

If not can jQuery do this? If so, how?

Ta, Luv2.
0
Comment
Question by:Luv2Muff
  • 3
  • 3
7 Comments
 
LVL 18

Expert Comment

by:Eternal_Student
ID: 33598157
You can't do this with CSS.
0
 
LVL 22

Expert Comment

by:kadaba
ID: 33598333
one of the ways.

<!DOCTYPE html>
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.min.js"></script>
  <script type="text/javascript">
  $(document).ready(function(){
	$("img").each(function(){
		$(this).attr("title",$(this).attr("title").toUpperCase());
	});	
  });
  </script>
  <style type="text/css">
  img{
	width:300px;
	height:200px;
  }
  </style>
</head>
<body>
<img src="http://www.costpernews.com/wp-content/uploads/2007/04/google_logo.jpg" title="google"></img>	
<img src="http://www.amitbhawani.com/blog/Images/B/Bing-Logo-White.jpg" title="bing"></img>	

</body>
</html>

Open in new window

0
 

Author Comment

by:Luv2Muff
ID: 33603491
Thanks that is great and works a treat.

Ideally I would just like to capitalize just the first letter of each title. I'm aware of :first-letter but unsure if that can be made to work with a title, or if there is another way?

Ta, Liv2.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Luv2Muff
ID: 33603508
Thanks that is great and works a treat.

Ideally I would just like to capitalize just the first letter of each title. I'm aware of :first-letter but unsure if that can be made to work with a title, or if there is another way to achieve this?

Ta, Luv2.
0
 
LVL 22

Accepted Solution

by:
kadaba earned 2000 total points
ID: 33603633
one of the way s like this...

<!DOCTYPE html>
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.min.js"></script>
  <script type="text/javascript">
  $(document).ready(function(){
	$("img").each(function(){
		var title = $(this).attr("title");
		title = title.charAt(0).toUpperCase() + title.substring(1);
		$(this).attr("title",title);
	});	
  });
  </script>
  <style type="text/css">
  img{
	width:300px;
	height:200px;
  }
  </style>
</head>
<body>
<img src="http://www.costpernews.com/wp-content/uploads/2007/04/google_logo.jpg" title="google"></img>	
<img src="http://www.amitbhawani.com/blog/Images/B/Bing-Logo-White.jpg" title="bing"></img>	

</body>
</html>

Open in new window

0
 

Author Closing Comment

by:Luv2Muff
ID: 33603651
Perfect, thank you!
0
 
LVL 22

Expert Comment

by:kadaba
ID: 33603656
Thanks, Have a nice day.

$kadaba
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses
Course of the Month16 days, 1 hour left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question