Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Capitalize the the title tag of an image

Posted on 2010-09-03
7
425 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…

860 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