Jump to content

margin-top and div

Recommended Posts

I have a question about margin-top.


I made a css script with span columns. The higher columns are supposed to push the lower ones down. I place them in a div, in here multiple columns.


The second column though, takes the top of the outer div as reference (not sure if that tis called parent). I find this strange. I tried to make a second div inside but it didnt work.


Can you only use div as a reference point or also a span element or p ?

Link to post
Share on other sites

Without seeing the code or a link to the page, I can only guess that you have conflicts coming from inappropriate combinations of properties that impact positioning.

Link to post
Share on other sites

Sorry I didnt post the code yet.


I solved the problem above by making divs around the spans and set the position.


But actually I think I can simplify my script.


I give an example, imagine you have a div and a span inside like this:

     <div class='pos1'>
      <span class = 'con1'>
      <div class= 'pos2'>
       <span class = 'con2'>


this is basically how i installed a parent child block where con1 is the parent and can2 the child. For simple html this works, but now, while I'm going to loop it, it has its limitations, so I would like to set it all in css.


Is there a parent property or can you set the selectors in the css script?

Edited by WesleyA
Link to post
Share on other sites

If only that was valid html passed by html validator, I might! Have considered helping.


I'm not sure if my code is correct, but this principle worked for me.


I'm looking for a way to create text containers that pad down the rest of the page.


How is a parent child element created then in html? And how is it done in css?

Link to post
Share on other sites

too bad. The thing is I'm no expert at css. Actually I'm like totally unintelligent.


But the positive thing is that I'm willing to learn.


I have a lot of questions. Dozens!


for anybody who likes to answer questions please ... is it possible to use position relative and overflow in a way that the lower text moves downwards?

Link to post
Share on other sites

Hmmm.... there seems to be a communication problem here. CSS is worthless to you if the HTML is not correct. The code you posted does not come anywhere near being valid and until you have correct HTML you cannot expect any consistent performance of either layout or presentation.


So let me see if I can make this clear.



Edited by COBOLdinosaur
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...