Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok, This is what you have to do :</p> <ul> <li>You need to remove the display:inline-block from #logo1</li> <li>And instead of just writing margin-top:10px , you need to use margin:0px auto, or you could write margin:10px auto. By this, it will center your #logo1 div. </li> <li>But to center a "div" , you need to have another container(div) that wrap within your div. So that it will know, from which side to which side that it will have to be "centered".</li> <li>For that reason, you will need to create another div or container around your #logo1 div, and lets assume it is called "right" (see the code below).</li> <li>And for this div/container to be just beside your sidebar, it will need to have a relative position same as your sidebar. Now, you can just float both of your #sidebar1 and also your #logo1 to the left.</li> <li>Thus, you dont have to use that negative margin for your sidebar anymore (remove that). If you wanted to use the negative margin, you have to use the absolute position in this case. But you will then have to restructure your whole #logo1 div which will create a lot of works.</li> </ul> <p>This is the full code for your reference :</p> <p>HTML code :</p> <pre><code>&lt;div id="container"&gt; &lt;div id="sidebar1"&gt; &lt;a href="https://test.com/" target="blank"&gt; &lt;div id="test1"&gt;This is sidebar&lt;/div&gt; &lt;/a&gt; &lt;/div&gt; &lt;div id="right"&gt; &lt;div id="logo1"&gt; &lt;div id="logo2"&gt;&lt;This is logo&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>And use this CSS :</p> <pre><code> #container{ width:1000px; height:1080px; position:absolute; border:1px solid #000; } #test1 { display: inline-block; position: relative; border: 1px solid; margin-top: 15px; margin-left: 22px; background-image:url('Afbeeldingen/2.png'); height: 45px; width: 45px; } #test1:hover { display: inline-block; position: relative; border: 1px solid; margin-top: 15px; margin-left: 22px; background-image:url('Afbeeldingen/1.png'); height: 45px; width: 45px; } #sidebar1 { display: inline-block; position:relative; float:left; border: 1px solid; background-image:url('Afbeeldingen/lol.png'); height: 1080px; width: 118px; border:1px solid red; } #right{ position:relative; float:left; margin-top:0px; width:870px; height:100px; } #logo1 { position:relative; border: 1px solid; margin: 0px auto; height: 100px; width: 700px; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload