Solved

Capitalize the the title tag of an image

Posted on 2010-09-03
7
419 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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Inline input fields - Contact Form 7 5 20
Hovering effect 9 29
Jquery autocomplete 10 26
Help cleaning out CSS 2 26
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now