Solved

Capitalize the the title tag of an image

Posted on 2010-09-03
7
424 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

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 500 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to dynamically set the form action using jQuery.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

770 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