Whats wrong ?

+1 Shreyansh Rana · November 8, 2014
Guys please see :

<!doctype html>
Test program
<body style="background-color:white">
<div style="font-size:500%;text-align:right;font-family:sandy ravage;color:white;background:black;padding: 5cm;
border-width: 1cm;border-style:solid;border-color:white;margin: 5cm 6cm 5 cm 6cm">
<p><div style="color:violet">N</div> <div style="color:indigo">T</div> <div style="color:blue">S</div> <div style="color:yellow">E</div></p>


I want all letters to be in different colours and in same line but am unable to do that . Please help.

Post a Reply


Oldest  Newest  Rating
0 Ron Butcher · November 10, 2014
What Ranie said.  The reason is that the "div" element is a block element.  Those stack on top of each other when the browser displays them.  A "span" element is an inline element that continues to read left to right just like the letters in the code.
0 Yousef Al-Hadhrami · November 10, 2014
You should try to find a JQuery or another scripting method for that, or create one if you did not find, and just change the class name for 1 div element that contains the text and makes the color of each letter different
doing a div or span element for 1 letter at a time is time consuming and not efficient
  • 1

HTML / CSS / Web Design


Discuss, share, ask, learn and teach HTML5 and CSS3.