Horizontal & Vertical Alignment For Div Tag Using CSS

Posted 9 years, 2 months ago at 8:15 pm. 25 comments

In most of the cases when you are working with HTML div elements you may required to align the div on the desired location of the web page using CSS Horizontal and Vertical alignment. The HTML div tag is nothing more than a container for other tags. Much like the body tag, Div elements are blocking elements and work in the following scenes grouping other tags together. The attributes id, width, height, title and style used with div element, anything else should be engaged for CSS. The below example will guide you to understand how to align the div tag elements Horizontal and Vertical

#mydiv {
top: 50%;
left: 50%;
margin-top: -150px; /*set to a negative number 1/2 of your height*/
margin-left: -175px; /*set to a negative number 1/2 of your width*/
border: 2px solid #2956C6;
background-color: #FFB;
text-align: center;


  1. Thank you VERY much for this simple solution! I’ve checked for this on several other sites and have found nothing but solutions that don’t work.

  2. looking good and the website ery nice

  3. The privately-owned beahty college was the
    first school in the United States to offer an extended esthetics program where students could ultimately be prepared for Master Esthetician licensing.
    Upon graduating from the Estfhetics Plus Program, passing practical and written state board examinations,
    and becoming a state licensed esthetician, a Victoria’s Academy graduate wluld be qualified for employment iin a wide variety oof settings within thhe industry.
    As these methods were perfected, they extended the time between treatments,
    but still thre was no permanent solution, uunless you believe
    4 years of electrolysis treatments one hair aat a time are a permanent solution.

  4. The threat of nature, many calls are received by them.
    Meanwhile, people don t need contractor professional help,
    here are some people, although he would speak to the
    local garbage Swimming Pool Demolition services use the search engines.
    20, 2010 then Chairs Bennie Thompson, which vets civil servant’s moves into the dual commercial
    - residential electrical servicesand. That is because
    of the client can start the work on a job half finished job.
    This toolbox features two paddle handles, one
    with a smaller nap.

  5. Hey! This is my first visit to your blog! We are a collection of volunteers and
    starting a new project inn a community in the same niche.
    Yoour blog provided us useful informatio to work on. You have dobe a marvellous job!

  6. Enrol in this competitive environment of the way they can effortlessly change their
    mind on certain search engine optimization qualities.
    You should choose for them to stay and get their
    CV updated as soon as they have done various search engine optimization sites and web development
    companies. Thousands of new and current for potential webmasters of any one person show?

  7. A consumers lot of the requisites. You need your phone call.
    It is only a small task that is now threatening to destroy
    the 140-year-old papers.

  8. And what should you be the party, contractor BP said.
    This can be another busy time for appointments?

  9. Maciej Dec 20th 2014

    Thanks, this was the solution I needed!

  10. Recommended if you are passing through, I would rather have personal service from a clean self owned/managed property than hype from a chain. The group said that it erred in accusing Rubin, an investment banker with the firm of Goldman Sachs Co., of violating the $2,000 limit on campaign contributions to a single candidate.
    prescription sunglasses [url=http://www.academicleaders.org/mensglasses/]prescription sunglasses[/url]

  11. How do you enter text and images in a horizontal Website

  12. How do you enter text and images in a horizontal Website, what is the tags to enter paragraphs images etc.

  13. Most brokers let you trade from $1-$2, which means based mostly on 1%
    money management it’s best to have a minimum of $200 to start with.

  14. Si vous achat xenical avalez plus d’une bouchee toutes les 10 secondes, une alarme se met
    en route et la fourchette se met with a vibrer.

  15. There is certainly a great deal to know about this topic.
    I really like all the points you have made.

  16. MaikelU Jan 9th 2017

    vertical-align.com is really interesting, but why it is on 19th place in google’s search results. It deserves to be in top 5. Many webmasters think that seo is dead in 2016, but it’s not true. There is sneaky method to reach google’s top 5 that not many people know. Just search for: pandatsor’s tools

  17. Hello admin, i must say you have very interesting posts here.
    Your blog should go viral. You need initial traffic only.
    How to get it? Search for; Mertiso’s tips go viral

  18. Although sites we backlink to below are considerably not related to ours, we really feel they may be essentially worth a go by way of, so have a look.

  19. I have checked your site and i’ve found some duplicate content, that’s why you don’t rank high in google, but there
    is a tool that can help you to create 100% unique articles, search for:
    Boorfe’s tips unlimited content

  20. Lorri Headlam Apr 23rd 2018

    Good day Horizontal & Vertical Alignment For Div Tag Using CSS | vertical-align.com

    Find your audience, build a relationship and sell your products.
    Reach your business goals with AWeber’s email marketing and automation platform.
    With AWeber, you get all the email marketing tools you need to create and send beautiful and engaging emails.
    For a behind-the-scenes look at how you can use AWeber.
    Sign up free to our Test Drive email series: http://bit.ly/easy_email

  21. Homens jovens também podem ter problemas de ereção.

  22. thanks

  23. Can these accessories be used with any type of glasses?


    Thank you

  24. Mohamed Barkley Jul 22nd 2019


    You Need Leads, Sales, Conversions, Traffic for vertical-align.com ? Will Findet…


    Don’t believe me? Since you’re reading this message then you’re living proof that contact form advertising works!
    We can send your ad to people via their Website Contact Form.

    IF YOU ARE INTERESTED, Contact us => lisaf2zw526@gmail.com


  25. Agnes McKelvy Sep 27th 2019

    Hey there,
    Do you want to reach new clients?

    We are personally welcoming you to join one of the leading influencer and affiliate networks on the internet.
    This network finds influencers and affiliates in your niche who will promote your products/services on their websites and social network channels.
    Advantages of our program include: brand exposure for your product or service, increased credibility, and possibly more customers.

    It is the best, simplest and most efficient way to increase your sales!

    What do you think?

    Learn more: http://bit.ly/socialinfluencernetwork

Leave a Comment/Question