Title: Align div inside parent div &amp; padding not working
Last modified: September 16, 2016

---

# Align div inside parent div & padding not working

 *  [antonio102](https://wordpress.org/support/users/antonio102/)
 * (@antonio102)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/align-div-inside-parent-div-padding-not-working/)
 * Hi! I’m working on a little menu, here is it:
 * [MENU](https://jsfiddle.net/nv4bh1nq/)
 * the are two problems:
 * 1) Div1, Div2, Div3, Div4, Div5 are not inside div “menu”
    2) for the mobile 
   version i’m not able to set a padding for the divs

Viewing 1 replies (of 1 total)

 *  [ThemeSumo](https://wordpress.org/support/users/themesumo/)
 * (@themesumo)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/align-div-inside-parent-div-padding-not-working/#post-8190479)
 * Your menu structure should be made up of a unordered list, like so:
 *     ```
       <div class="menu">
           <ul>
               <li class="Div1"><a href="#chi-siamo">Chi Siamo</a></li>
               <li class="Div2"><a href="#contatti">Dove Trovarci</a></li>
               <li class="Div3"><a href="#servizi">Servizi Investigativi</a></li>
               <li class="Div4"><a href="#formazione">Formazione</a></li>
               <li class="Div5"><a href="#news">News</a></li>
           </ul>
       </div>
       ```
   
 * Which you can simply style with:
 *     ```
       .menu {
           width:100%;
           text-align: center;
           box-shadow: 0px 0px 6px 2px #D8D9DA;
       }
   
       .menu ul {
           border: 1px solid #000;
       }
   
       .menu li { 
           display: inline-block; 
           padding: 10px 15px;
       }
       ```
   
 * You can control responsive styles like this:
 *     ```
       @media screen and (max-width: 620px) {
           .menu li { 
               padding: 25px; 
           }  
       }
       ```
   
 * I have removed the padding and border away from the menu class as you want this
   to be 100% wide, the border has been applied to the `ul` with the padding now
   being applied to each `li` instead.
 * [JSFiddle](https://jsfiddle.net/nv4bh1nq/1/)
 * Hope this helps.

Viewing 1 replies (of 1 total)

The topic ‘Align div inside parent div & padding not working’ is closed to new replies.

## Tags

 * [div](https://wordpress.org/support/topic-tag/div/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [ThemeSumo](https://wordpress.org/support/users/themesumo/)
 * Last activity: [9 years, 7 months ago](https://wordpress.org/support/topic/align-div-inside-parent-div-padding-not-working/#post-8190479)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
