Jump to content
  • 0

div меню со span'ами и justify


freeek
 Share

Question

решил написать резиновое меню с простым концептом:

<div id="menu">
<span>menu element 1</span>
<span>menu element 2</span>
<span>menu element 3</span>
</div>

на div решил указать text-align: justify и на кажды span небольшие горизонтальные padding'и. тоесть весь мой css выглядит так:

#menu {text-align: justify;}
#menu span {padding: 0 5px;}

но текст не тянется на ширину div'a и располагается слева. нужен совет по исправлению или новый концепт (желательно первое).

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Первая строка текста не растягивается согласно спецификации CSS2:

In the case of 'justify', this property specifies that the inline-level boxes are to be made flush with both sides of the block container if possible, by expanding or contracting the contents of inline boxes, else aligned as for the initial value.

По этому нужно использовать либо CSS3 свойства, в частности text-align-last или различные ухищрения типа дополнительных блоков, растянутых на ширину контента.

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   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.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy