Avatar of ChefMaha
ChefMaha

asked on 

how to vertically align text inside a marquee

I need to have my marquee text right in the middle of the background image (vertically)

how is that possible?

<div id="banner">
 
<marquee direction="left" class = "banner" behavior="scroll" height="29px">
 
'D#.('1 'D,/J/) GF'
&nbsp;
<img src="images/yellowdot.gif" />
</marquee>
 
 
</div>

Open in new window

HTMLCSS

Avatar of undefined
Last Comment
ChefMaha
Avatar of Bruce Pieterse
Bruce Pieterse
Flag of South Africa image

in your CSS stylesheet:

#banner img {
  border: none;
  vertical-align: middle;
}

if you would like to apply that style to all images (vertically aligned to text) just remove #banner. :)

Hope this helps
Avatar of ChefMaha
ChefMaha

ASKER

thanks. But, unfortunately it did not change anything..

and besides, I need to also vertically align the text (not just the image)
Avatar of rajanibajpai
rajanibajpai

Hi
this is your code.
Just try it
<div id="banner">
 
<marquee direction="left" class = "banner" behavior="scroll" height="29px" align="middle">
 
'D#.('1 'D,/J/) GF'
&nbsp;
<img src="images/yellowdot.gif" />
</marquee>
 
 
</div>

Open in new window

Avatar of ChefMaha
ChefMaha

ASKER

no change...

ok I guess the problem is that you don't have the image that I'm using.

I suggest you create a simple image with the height 29px, make it the background of your marquee, add some text to the marquee and then tell me if it works or not.

thanks for your help
ASKER CERTIFIED SOLUTION
Avatar of Bruce Pieterse
Bruce Pieterse
Flag of South Africa image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Hi ChefMaha,

Any luck with the above mentioned solution?
Avatar of ChefMaha
ChefMaha

ASKER

I am very sorry for the late reply brucepieterse. But,  I was on vacation and just got back!

thanks for the reply. I have tested your code and it worked perfectly. However, when I tried to increase the height of the marquee, the text and image were no longer middle vertically aligned.

so, in order to solve this issue, I put the background image in the div tag instead of the marquee tag. and that's when it started to work properly.

thanks for the push however. your solution helped me figure things out!
div#banner {
	margin: 0;
	padding: 5px 0;
	background: url('images/banner.gif') repeat-x;
	
}

Open in new window

Avatar of ChefMaha
ChefMaha

ASKER

this answer helped me find the solution to my problem.
thanks expert =)
HTML
HTML

HTML (HyperText Markup Language) is the main markup language for creating web pages and other information to be displayed in a web browser, providing both the structure and content for what is sent from a web server through the use of tags. The current implementation of the HTML specification is HTML5.

62K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo