Jump to content

Text Alignement


coco243

Recommended Posts

position:absolute is rarely the best solution.Text should be in a container, such as a <div> or a <p>. You normally position a <div> with a float property. <p> elements normally are positioned inside divs, but when they are not, float also works for them. Most elements with a float property should have a width property also.To align text within a container, use text-align.

Link to comment
Share on other sites

position:absolute is rarely the best solution.Text should be in a container, such as a <div> or a <p>. You normally position a <div> with a float property. <p> elements normally are positioned inside divs, but when they are not, float also works for them. Most elements with a float property should have a width property also.To align text within a container, use text-align.
Of course that my text is inside of a div, and then in a paragraf, but I want for example a title for my text inside that div, and after, paragraphs, I want a method to possitonate the paragraphs in that div. I want methods in text possitioning/layout in divs. Tahnks
Link to comment
Share on other sites

<style type="text/css">	div.container {		width: 900px;		margin: 0 auto;	}	p.center {		text-align: center;	}</style>*   *   *<div class="container">	<p class="center">MY TITLE</p>	<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent sed mauris quis arcu bibendum blandit. Donec laoreet lacinia turpis. Vestibulum nec dolor vel orci ullamcorper fringilla. Nullam et eros non ligula condimentum consequat. Nullam et leo. Quisque auctor elementum elit. Maecenas ac augue. Nam tincidunt tincidunt neque. Aliquam in purus. Fusce aliquam suscipit erat.  </p></div>

Link to comment
Share on other sites

<style type="text/css">	div.container {		width: 900px;		margin: 0 auto;	}	p.center {		text-align: center;	}</style>*   *   *<div class="container">	<p class="center">MY TITLE</p>	<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent sed mauris quis arcu bibendum blandit. Donec laoreet lacinia turpis. Vestibulum nec dolor vel orci ullamcorper fringilla. Nullam et eros non ligula condimentum consequat. Nullam et leo. Quisque auctor elementum elit. Maecenas ac augue. Nam tincidunt tincidunt neque. Aliquam in purus. Fusce aliquam suscipit erat.  </p></div>

And if I want to put my title at 20% from the top and then to start a paragraph, and after that paragraph another one?
Link to comment
Share on other sites

	p.center {		text-align: center;		margin-top: 20%;}

or

	div.container {		width: 20% auto 0;	}

might be better?Depends on what is above the Title.The title should be a Heading tag, too, by the way, instead of a paragraph. Both are Block level containers, but the h-tag implies a better definition of the contents of the tag. After all, the purpose of the 'title' is to provide an understanding of the page structure. Search Bots will like it better.

Link to comment
Share on other sites

	p.center {		text-align: center;		margin-top: 20%;}

or

	div.container {		width: 20% auto 0;	}

might be better?Depends on what is above the Title.The title should be a Heading tag, too, by the way, instead of a paragraph. Both are Block level containers, but the h-tag implies a better definition of the contents of the tag. After all, the purpose of the 'title' is to provide an understanding of the page structure. Search Bots will like it better.

Very cool man, that really helped me, I was using just <p> tag and absolute position and nothing was working, but that div container, was fixed after the paragraph, thanks. One more question, and if after that div container or in the div I want to insert text with fixed left and top margins what code shood I use? Thanks
Link to comment
Share on other sites

Well, for me instead of doing a CSS then using a class="whatever" just use align="alignment". if you want a <p> tag aligned then do <p align="center"> and it will be center.
Alignment is working when you want to center something horizontaly but if you vant and verticaly adjustment you need to use style.
Link to comment
Share on other sites

And using in-line code is not the best way to do it. Separation of the content and the style is a goal of the whole process. Give the paragraph a class and handle the styling in the CSS. There ia already a class defined for centering the paragraph. Use that one.

Link to comment
Share on other sites

Well, for me instead of doing a CSS then using a class="whatever" just use align="alignment". if you want a <p> tag aligned then do <p align="center"> and it will be center.
The align attribute is deprecated. And it's always better to separate content from presentation.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...