Click here to Skip to main content
15,889,200 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please help me!
How can we control the font size in CSS.

Thanks in advance!
Posted
Updated 29-Dec-10 1:05am
v2

Well I would use font-size : 2em; for instance. What are your issues?

Modified with example:

HTML
<html  xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <style type="text/css">
        div#myText {
            font-size: 1.5em;
            width : 200px;
            height : 50px;
            border: solid 5px green;
        }
    </style>
</head>
<body>
    <div id="myText" style="width:1000px; height:400px; border: solid 5px green">
    This is some text in a div tag
    </div>
</body>
</html>


Look for font-size inside the style tag in the head section of the html.
End modification. Observe how the link from CSS to the div is made by the CSS selector div#myTxt.

Regards,

Manfred
 
Share this answer
 
v3
#myText
{
font-size: 1.5em;
width : 200px;
height : 50px;
border: solid 5px green;
}



Dear friend u write a wrong code here
for id of any html tag we need to use #myText with its id name.ok
not div#myText.

ok..
 
Share this answer
 
Comments
Manfred Rudolf Bihy 29-Dec-10 8:26am    
You are wrong, my friend. div#myText is the correct CSS selector to make sure that only a div with the id of "myText" is styled with the according format. Please read up on CSS selectors:
http://www.w3.org/TR/CSS2/selector.html
when you have browsed to that page search for this E#myid.
Thanks for bearing with me.
Cheers!
Manfred Rudolf Bihy 29-Dec-10 8:29am    
Besides that OP didn't ask to format every tag with the same id with a given font-size. He just wanted to know how to do it at all and I gave him a working example.
mohammadrijwan 30-Dec-10 6:43am    
yes dear u r right but i m using both they work fine...
there is no any problem..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900