• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

centralizing the <p> tag

 
Ranch Hand
Posts: 391
1
MySQL Database PHP Java
  • Mark post as helpful
  • send pies
  • 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%
 
Marshal
Posts: 67447
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thank you bear it works , can you explain how its working.
And how it is browser independent
 
Bear Bibeault
Marshal
Posts: 67447
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • 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.
 
Humans and their filthy friendship brings nothing but trouble. My only solace is this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic