May 23, 2013

HTML Tag Contains Display Table and Display Inline-Block

Someyoungideas’s Question:

I am looking to truncate a tag in html with ellipsis and to do so it needs to be display: inline-block, block, etc. The problem is that I also have a class on it that contains the css of display: table. The tag is keeping both display styling somehow and will not allow the ellipsis to occur. Why is both display styles allowed instead of one overriding the other?

I understand I could remove the class with the display: table, but I am more curious why it can hold both display styles.

One element can have one display property at a time not two. You can override the style by providing inline style instead like

<div style="display: inline;">

Doing so will override any other style property defined before.

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+


Please fill the form - I will response as fast as I can!