• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

centralizing the <p> tag

 
Ranch Hand
Posts: 391
1
MySQL Database PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am facing this problem ,

On my site mahtabalam.net , I have this issue

The page design of the almost each page is like ,

first menu will be shown
then <h3> tag with heading of the page will come in center.

Then I will have some paragraphs <p> tag that I want to show below heading ,

I want to show these <p align="justify"> with that <p> tag should start from center of the page not from left part of the page.

So what I did is I put these <p> tag inside <div> and positioned the div where I wanted by <div style="position:absolute;top:200px;left:200px"/> , what now when i change browser zoom say
100 to 110 or 100 to 90 it looks very ugly.

Even if I keep the browser zoom to 100 and open it in firefox , it looks very bad.

What I can do ?

You can see the problem live at Problem

Change the browser zoom to 110% or 90%
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You mean "centering" not centralizing.

To center an element using CSS, you give it a width, then set the left and right margins to auto.

for example:
 
Mahtab Alam
Ranch Hand
Posts: 391
1
MySQL Database PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you bear it works , can you explain how its working.
And how it is browser independent
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mahtab Alam wrote:Thank you bear it works , can you explain how its working.
And how it is browser independent


It works because that's the way that CSS auto margins are defined. The same way that setting something to red makes it red.

And it's browser-independent in that it's standard CSS, not a browser-specific implementation.
 
I've read about this kind of thing at the checkout counter. That's where I met this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic