CodeWithHarry / Sigma-Web-Dev-Course

Source Code for Sigma Web Development Course
6.27k stars 1.93k forks source link

text-overflow: ellipsis works as text-overflow: clip #189

Closed Raj-Shekhar-Bakshi closed 5 months ago

Raj-Shekhar-Bakshi commented 5 months ago

Code in html

<div class="txt-overflow">
        <p>This is for text overflow. Lorem ipsum dolor sit, amet consectetur adipisicing elit. A provident maxime exercitationem deleniti velit dicta quidem vitae sit quam eius.</p>
</div>

Code is css

.txt-overflow{
    background-color: rgb(168, 236, 57);
    border: 2px solid;
    width: 45px;
    overflow:hidden;
    text-overflow: ellipsis;
}

When I use this code, ellipsis work as clip. But as soon as I give class to the para, and remove class from div, it works properly. So, I want to know that why this happens? @CodeWithHarry please reply.

Raj-Shekhar-Bakshi commented 5 months ago

I got my answer on my own. .txt-overflow p{ } before I was wrong. This one is correct......