Search code examples
htmlcsstexthtml-table

I have a problem with space between text and border


.container{
    margin: 0 auto;
    max-width:1200px;
}
.description{
    width:100%;
    background-color:white;
    display:flex;
    border-spacing:80px;
    border-collapse:separate;
    border:1px solid black;
}
.about-me-title{
    color:black;
    font-size: 55px;
    font-weight: bold;
    margin-bottom:100%;
    display:flex;
    flex-direction: column;
    align-items:start;
    border-bottom: 2px solid grey;
}
.about-me-text{
    font-weight: bold;
    font-size: 25px;
    color:black;
    margin-bottom: 15px;
}
.about-me-little-text{
    font-size: 20px;
    color:black;
    margin-bottom: 30px;
}
td{
    vertical-align:top;
    border:1px solid black;
    padding: 3px;
    
}
tr{
    border:1px solid black;
    
}
<div class="container"> 
    <table class="description">
        <tr>
            <td>
                <div class="about-me-title">O Mnie</div>
            </td>
            <td>
                <div class="about-me-text">What is Lorem Ipsum?</div>
                <div class="about-me-little-text">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry'sLorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="about-me-title">Doświadczenie</div>
            </td>
            <td>
                <div class="about-me-text">Why do we use it?</div>
                <div class="about-me-little-text">It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing</div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="about-me-title">Osiągnięcia</div>
            </td>
            <td>
                <div class="about-me-text">Opis moich osiągnięć</div>
                <div class="about-me-little-text">Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia</div>
                <div class="about-me-text">Opis moich osiągnięć</div>
                <div class="about-me-little-text">Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia</div>
                <div class="about-me-text">Opis moich osiągnięć</div>
                <div class="about-me-little-text">Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia</div>
            </td>
        </tr>
    </table>
</div>

Problem Image

Red arrow means space between border and my text, I want to cancel it. I was looking for my problem on others websites, but I can't find a solve. If somebody have an idea, tell me pls. Its really important for me..


Solution

  • Are the tables necesary? They are a bit hard to style-contorl, but in case they are. If you remove the margin-bottom from the .about-me-title, the rows will shrink to the content height:

    .container{
        margin: 0 auto;
        max-width:1200px;
    }
    .description{
        width:100%;
        background-color:white;
        display:flex;
        border-spacing:80px;
        border-collapse:separate;
        border:1px solid black;
    }
    .about-me-title{
        color:black;
        font-size: 55px;
        font-weight: bold;
        /*     margin-bottom:100%; */
        display:flex;
        flex-direction: column;
        align-items:start;
        border-bottom: 2px solid grey;
    }
    .about-me-text{
        font-weight: bold;
        font-size: 25px;
        color:black;
        margin-bottom: 15px;
    }
    .about-me-little-text{
        font-size: 20px;
        color:black;
        margin-bottom: 30px;
    }
    td{
        vertical-align:top;
        border:1px solid black;
        padding: 3px;
        
    }
    tr{
        border:1px solid black;
        
    }
    <div class="container"> 
        <table class="description">
            <tr>
                <td>
                    <div class="about-me-title">O Mnie</div>
                </td>
                <td>
                    <div class="about-me-text">What is Lorem Ipsum?</div>
                    <div class="about-me-little-text">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry'sLorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. </div>
                </td>
            </tr>
            <tr>
                <td>
                    <div class="about-me-title">Doświadczenie</div>
                </td>
                <td>
                    <div class="about-me-text">Why do we use it?</div>
                    <div class="about-me-little-text">It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing</div>
                </td>
            </tr>
            <tr>
                <td>
                    <div class="about-me-title">Osiągnięcia</div>
                </td>
                <td>
                    <div class="about-me-text">Opis moich osiągnięć</div>
                    <div class="about-me-little-text">Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia</div>
                    <div class="about-me-text">Opis moich osiągnięć</div>
                    <div class="about-me-little-text">Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia</div>
                    <div class="about-me-text">Opis moich osiągnięć</div>
                    <div class="about-me-little-text">Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia</div>
                </td>
            </tr>
        </table>
    </div>