2 replies [Last post]
Marcmc
Offline
newbie
Last seen: 8 years 36 weeks ago
Timezone: GMT-3
Joined: 2012-08-22
Posts: 1
Points: 2

Why the parameter "display: block" can be explicitly attributed to block elements like DIV and lists?

Marcelo Cavalcante
Rio de Janeiro - Brazil

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 3 days 1 hour ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5343
Points: 2964

Because sometimes we like to

Because sometimes we like to use them in situations where block is not correct display property.

For example a H1 set to display inline so text continues on after it instead of below.
Or if you hide a Div using display:none; and want to show it again you need to set it to display:block;

mihirc
mihirc's picture
Offline
Leader
Pune, Maharashtra, India
Last seen: 6 years 39 weeks ago
Pune, Maharashtra, India
Timezone: GMT+5.5
Joined: 2007-05-09
Posts: 728
Points: 204

Marcmc wrote: Why the

Marcmc wrote:

Why the parameter "display: block" can be explicitly attributed to block elements like DIV and lists?

Marcelo Cavalcante
Rio de Janeiro - Brazil

It can also be given to elements like a, etc. This will allow you to use CSS attributes like margins, paddings, floats, etc

Regards,
Mihir.

Proprietor - Thoughtfulviewfinder Services
Web Development | Design | Merchandise | Photography
My personal blog: MihirChhatre.com