#parent { display: table-cell; width: 100px; height: 50px; padding: 0 10px; border: 1px solid red; } #inner { display: block; width: 100%; height: 100%; border: 1px dotted green; /*Надо растянуть элемент с учетом padding, то есть чтобы ширина была 110px*/ } 
 <div id="parent"> <a id="inner">TextThatShould</a> </div> 

  • Why do so? - HELO WORD
  • 2
    To add a snippet, click this button on the picture: i.stack.imgur.com/ZPQvE.png - VenZell
  • @HELO, For an external div to be clicked as a link - Herrgott
  • @VenZe, thanks - Herrgott
  • write more for what you do? - HELO WORD

1 answer 1

I think the following option will suit you:

 #parent { display: table-cell; height: 50px; border: 1px solid red; } #inner { display: block; height: 100%; border: 1px dotted green; /*Надо растянуть элемент с учетом padding, то есть чтобы ширина была 110px*/ padding: 0 10px; } 
 <div id="parent"> <a id="inner" href="#">TextThatShould</a> </div> 

  • And why, as I expected, the text area does not crawl over the size of the parent? - Herrgott
  • @Herrgott and why does the child have to get out of the parent, especially when the parent is a cell) - Vasily Barbashev
  • @Basily, I just often met with such behavior and many times threw the study of web design. Apparently all the same display: table-cell does what it takes - Herrgott
  • @ Vasily, for example, I now have such a problem. <ul> climbs out of the parent <div> - Herrgott
  • one
    @Herrgott display everything. He is responsible, just the same, for the behavior of the element on the page. And in fact, it is more correct that it is the heir who was stretching the parent (in cases with menus or items) - Vasily Barbashev