alt text How to put the table in the center, but so that it starts from the top? And then I put

<table align="center"> 

and he takes from the center of the screen builds it. And I want to start from above, and I myself was in the center. So I want to do

  |xx|yy|zz| |xx|yy|zz| |xx|yy|zz| 

I’ve done post XX, but right now I want to make YY, but it is placed in the center, that is, in place of the second YY, and I want to put a position from the first YY

  • @ navi1893, Please rephrase your question: correct grammatical errors, correctly place commas. If you add more clarifying information, you will speed up the receipt of the answer. - sinedsem
  • here, laid out a photo. I want to make the red rectangle go up to the blue line. I put the margin-top, nothing happens. He does not rise @Dazar - navi1893
  • @ navi1893, are there two different tables in the picture? - sinedsem
  • @Dazar yes, they are different - navi1893

4 answers 4

There is some kind of paradox or I did not understand correctly. The table is centered, but I want it to be centered =)). About the fact that it started from the top, for the parent we set this parameter - vertical-align:top;

    In order to put two or more block elements in one row, it is necessary that all of them (except the last) “float” : the CSS property float: left or float: right must be specified for them, depending on where these elements are must "float" - left or right.

    Here, for example, it is written in more detail: http://htmlbook.ru/css/float .

    In your case, it is enough to specify the float: left property on the left of the block, so that it "lets" the central block to its level.

    In addition, you can try to put a negative margin-top value. But it is rather a hack, and it is better to do without it.

    Another possible, but outdated solution is to combine elements with an invisible table, and insert them as cells of this table. True, this is now considered a move.

    • one
      not necessary, there is still display: inline * about moveton - this is a word for bydlokoderov invented so that they do not do stupid things. I'm not talking about table layout, but in general. - zb '
    • @eicto, really. But if you turn the block into a string element, various unpleasant effects can occur. - khaos

    Once the tables are different, in order for them to be on the same level, the first table should be set style='float: left;'

      I just can't understand: why does everyone hate tables so much? I understand if we are talking about a layout with kilotons of cells, with porridge from rowspan / colspan attributes. When the result is a layout of solid tables containing tables, tables, ..., tables. This is the moveton. And to use the table where it is really necessary is not a crime, in my opinion. Especially when the language turns: "it will be three columns." Column! So why not use it? Why resort to some kind of hack in the form of a flow to the right when you need to make 2 columns? What, a lot of markup? Nothing much! Browsers do not care for a long time: positioning them with 1 element or 4. 100M network card has also been spat for a long time, in contrast to the 56K modem. And the editors with syntax highlighting are there - you won't get lost in the markup.

      Oh well, we now have a good opportunity for "semantic" markup. Although it was always like this, it was just for sophisticated web designers that there were added more elements - for normal structuring.

      But we also have a CSS miracle, right? You can also not write <table> , while forcing the layout to behave like a table.

      http://jsfiddle.net/qJdy4/1/


      I dare, nevertheless, to assume that the author himself used the “table” where it really does not belong. I thought that we just need a page with a list of songs [cover, title, player] in the style of tiles on the grid. Then, perhaps, this workpiece will do.

      • @Bars, that is why in my answer I also said about this method. Indeed, it can sometimes be effective to put a table and nothing wrong with that. Question of the choice of tools. - khaos
      • I apologize. I wrote this answer not from the desire to tear off your alternative proposal on the table, but in order to draw attention to the fact that here, from my point of view, you need exactly a table view, and not a wrapping trick. - Bars