{"id":356,"date":"2012-03-08T04:54:21","date_gmt":"2012-03-08T04:54:21","guid":{"rendered":"https:\/\/theextremewebdesigns.com\/blog\/?p=356"},"modified":"2012-03-08T04:54:21","modified_gmt":"2012-03-08T04:54:21","slug":"center-ul-using-css","status":"publish","type":"post","link":"https:\/\/theextremewebdesigns.com\/blog\/center-ul-using-css\/","title":{"rendered":"Center UL Using CSS Example"},"content":{"rendered":"<p>Have you wondered how to Center ul using pure CSS? Read on to find out how to do this using only few lines of CSS code.<!--more--><\/p>\n<h2>How to Center ul using CSS<\/h2>\n<div class=\"make_demo\">\r\n\r\n\t<form action=\"https:\/\/theextremewebdesigns.com\/blog\/wp-content\/themes\/ewd_blog_2017\/try_demo.php?post_id=356\" method=\"post\" name=\"form1\" target=\"_blank\" id=\"form1\">\r\n\r\n\r\n\t<input type=\"hidden\" name=\"shortcode_content\" id=\"shortcode_content\" value=\"\" \/>\r\n\r\n        <div class=\"try_demo_btn_container\">\r\n\r\n\r\n            <button type=\"submit\" name=\"sbt_make_demo\" id=\"sbt_make_demo\" class=\"btn-primary btn-try-demo\">\r\n                Try Demo\r\n            <\/button>\r\n\r\n\r\n        <\/div><!-- .try_demo_btn_container -->\r\n\r\n    <\/form>\r\n    <\/div>\r\n    \n<p>For this example, assume that we have an unordered list in a div container. The unordered list can contain as many list items as you want. That said, let&#8217;s look the code for the example.<\/p>\n<h3>Example: Centering unordered list in a div using CSS<\/h3>\n<pre class=\"lang:xhtml decode:true\">&lt;style type=\"text\/css\"&gt;\n.container {\ntext-align: center;\n}\n.container ul {\ndisplay: inline-block;\nmargin: 0;\npadding: 0;\n\/*IE Fix*\/\nzoom:1;\n*display: inline;\n}\n.container li {\nfloat: left;\npadding: 5px 5px;\n}\n&lt;\/style&gt;\n\n&lt;div class=\"container\"&gt;\n&lt;ul&gt;\n&lt;li&gt;One&lt;\/li&gt;\n&lt;li&gt;Two&lt;\/li&gt;\n&lt;li&gt;Three&lt;\/li&gt;\n&lt;\/ul&gt;\n&lt;\/div&gt;<\/pre>\n<div class=\"make_demo\">\r\n\r\n\t<form action=\"https:\/\/theextremewebdesigns.com\/blog\/wp-content\/themes\/ewd_blog_2017\/try_demo.php?post_id=356\" method=\"post\" name=\"form1\" target=\"_blank\" id=\"form1\">\r\n\r\n\r\n\t<input type=\"hidden\" name=\"shortcode_content\" id=\"shortcode_content\" value=\"\" \/>\r\n\r\n        <div class=\"try_demo_btn_container\">\r\n\r\n\r\n            <button type=\"submit\" name=\"sbt_make_demo\" id=\"sbt_make_demo\" class=\"btn-primary btn-try-demo\">\r\n                Try Demo\r\n            <\/button>\r\n\r\n\r\n        <\/div><!-- .try_demo_btn_container -->\r\n\r\n    <\/form>\r\n    <\/div>\r\n    \n<h5>That&#8217;s it!<\/h5>\n<p>If you know of any other ways to <em><strong>center a ul in a div using CSS<\/strong><\/em>, please feel free to share by leaving a comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you wondered how to Center ul using pure CSS? Read on to find out how to do this using only few lines of CSS code.<\/p>\n","protected":false},"author":1,"featured_media":276,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[18,13],"tags":[52],"class_list":["post-356","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-css-tips-and-tricks","category-tips-and-tricks","tag-css-tips"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/paBnQX-5K","jetpack_sharing_enabled":true,"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/356","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/comments?post=356"}],"version-history":[{"count":0,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/356\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/media?parent=356"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/categories?post=356"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/tags?post=356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}