javascript - How to put <ul> around image in css -


so, title says, want put <ul> around image. ul got 4 <li>, , want put 2 <li> on left side of image, , 2 <li> on right side:

<one>-----<two>-----(imagelogo.png)-----<three>-----<four> 

here how looks @ moment: enter image description here

as can see 4 <li> @ top left corner of site. put on blue line same <div> - #line . tried padding, looks bad, , hard control once page minimized or resized in way.

here html file:

<body>     <div id="line">         <div class="line-menu">             <ul class="menu-buttons">                 <li>one</li>                 <li>two</li>                 <li>tree</li>                 <li>four</li>             </ul>         </div>     </div>     <div id="top">             <div id="logo">                 <img src="images/chelsea-logo.png">             </div>     </div>     </body> 

and css file:

body {      background: url('../images/background.jpg') no-repeat center center fixed;     -webkit-background-size: cover;     -moz-background-size: cover;     -o-background-size: cover;     background-size: cover;     margin: 0;   }  #top{      width: 150px;     margin: 0 auto;     height: 150px;     z-index: 1; }  #top img {      position: absolute;     width: 150px;     height: 150px;     z-index: 1; }  #top img:hover {      width: 158px;     height: 158px;     transition: 0.3s ease; }  #line {      position: absolute;     top: 0px;     width: 100%;     height: 75px;     background: #423bd9; }  .line-menu {      width: 100%;     height: 100%;     margin: 0;     padding: 0; }  .line-menu ul {  display: inline-block; padding: 5px; margin: 25px;  }  .line-menu li {  padding: 0 89px; display: inline-block; } 

i'll provide more information if needed. thank in advance time.

here 1 way of doing it.

you have right idea using absolute positioning place logo on link panel.

i specified width li elements , applied text-align: center on parent ul keep centered.

to open space logo, added right-margin of 200px between 2nd , 3rd li elements, using nth-child selector.

you can adjust margins on various elements control spacing between , above li elements.

note, smaller screena, may need use media queries , make adjustments margins , on.

body {    margin: 0;  }  #top {    border: 1px dotted black;    position: absolute;    top: 0px;    left: 0;    right: 0;    text-align: center;  }  #top img {    vertical-align: top;    width: 150px;    height: 150px;  }  #top img:hover {    width: 158px;    height: 158px;    transition: 0.3s ease;  }  #line {    position: absolute;    top: 0px;    width: 100%;    height: 75px;    background: #423bd9;  }  .line-menu {    width: 100%;    height: 100%;    margin: 0;    padding: 0;  }  .line-menu ul {    display: block;    text-align: center;    margin: 20px 0 0 0;    padding: 0;  }  .line-menu li {    display: inline-block;    margin: 0 20px;    width: 100px;    border: 1px solid #cccccc;  }  .line-menu li:nth-child(2) {    margin-right: 200px;  }
<div id="line">    <div class="line-menu">      <ul class="menu-buttons">        <li>one</li>        <li>two</li>        <li>three</li>        <li>four</li>      </ul>    </div>  </div>  <div id="top">    <div id="logo">      <img src="http://placehold.it/150x150">    </div>  </div>


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -