P
P
Palax2016-06-22 18:18:02
css
Palax, 2016-06-22 18:18:02

How to solve the problem with the layout of the navigation bar with a description?

With position: absolute, the link in the buttons behaves as usual, spreading over the entire area of ​​the li list, but then the description enclosed in the tags is not centered and looks clumsy, not fitting into the button fields. I will be grateful for the answers.
4253bc1ad09446b4a494dd28ad5cd89f.png5b0d9a7922d343569d7c0a6e71158a27.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
metaf, 2016-06-22
@Danipala

When I was just starting to typeset, I was constantly told that a correctly asked question already contains an answer ...
Suppose you have a structure

<li>
  <a href="#">link</a>
  <span>description</span>
</li>

When there is no paragraph, there should be an empty space below the caption: a {margin-bottom: Xpx}, where X = the height of the paragraph.
When there is a paragraph, white space must be discarded: a:not(:last-child) {margin-bottom: 0}.
The paragraph should be centered, not wrap in words, and stretch the cell to its content li {text-align: center} span {white-space: nowrap}
Do you need this ? codepen.io/olgar/pen/EyNEXK

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question