We help IT Professionals succeed at work.

Beginner HTML question

sheana11
sheana11 asked
on
What tags would I have to use to get a paragraph centered and italicized?
Comment
Watch Question

Keith BrownAWS System Administrator
CERTIFIED EXPERT

Commented:
<i> </i> for italics
<center> </center> can be used for center an object. This is if you want to get the block centered.
<p style="text-align:center;"> </p> centers the text in the paragraph
<p align="center> </p> is the depreciated form of the above line

Open in new window

Have you Learned about CSS Yet? I myself find it easier to do all my formatting in CSS.
Keith BrownAWS System Administrator
CERTIFIED EXPERT

Commented:
Using the <p style="text-align:center;"> method is actually a form of CSS, however most declare their CSS settings all together, and then just call up the predefined CSS later on. That way they can reuse it if need be, without retyping all of the settings. Helps cut down on file size, and makes it easier to work with, since you can just tweak one thing instead of looking for every instance.
Thats what i was referring to, putting it on a CSS Sheet.
Keith BrownAWS System Administrator
CERTIFIED EXPERT

Commented:
I was just digging through W3School's site and ran across this

@font-face
{
font-family: myFirstFont;
src: url('Sansation_Light.ttf'),
     url('Sansation_Light.eot'); /* IE */
}

Open in new window


That would let you specify a font, and then give a URL for it if they don't have it installed. Take note that IE specifies a special format, while all other browsers can use standard truetype fonts.

On CSS, you can have it in a separate file, referenced like
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css" />
</head>

Open in new window


or internally such as
<head>
<style type="text/css">
hr {color:sienna;}
p {margin-left:20px;}
body {background-image:url("images/back40.gif");}
</style>
</head>

Open in new window


And then using the stype property in various tags, like I did before. You can also specify multiple things, so that way you can have different styles for different parts of the page, using the same tags.

Here's an example of that from w3schools
<html>
<head>
<style type="text/css">
p.ex1
{
font:15px arial,sans-serif;
}

p.ex2
{
font:italic bold 12px/30px Georgia,serif;
}
</style>
</head>
<body>
<p class="ex1">This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph.</p>
<p class="ex2">This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph.</p>
</body>

Open in new window

Top Expert 2013

Commented:
@Hellmark:

It is good to see you trying to help sheana11, but it is not helpful when you post all kinds of extemporaneous information that is not part of what is being asked for. Color, backgrounds, font-faces???

You will find that you are able to help better if you focus on what is being asked for.

 
Keith BrownAWS System Administrator
CERTIFIED EXPERT

Commented:
The font faces part was a goof on my part, was meant for another post.

The first post I did contained all the information asked for, short and to the point, and then the next after that, discussion continued with dellborg82 over CSS.
Top Expert 2013

Commented:
No problem, I just noticed you have not been real active as an expert and I'm just trying give a guidance that might help you help the users.
Programmer-analyst
Commented:
This is the code:

<center>
<i>
<p>This is your paragraph that would appear centered and italicized as you asked.</p>
</i>
</center>

Open in new window

Author

Commented:
Thank you for the clear answer. Just for everyone's information, I don't know CSS yet, but I will learn it in the next session of my class.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.