2

How to put external CSS for the given codes as it is a div with a class:

<div class="adv_post_container nolinks" id="activity-post-container" style="display: block;">

is it

#activity-post-container.adv_post_container.nolinks

OR

#activity-post-container .adv_post_container.nolinks

Or is there another way?

By the way, what is this called? I know div inside div is called "nested." What is this called?

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
Stephen Nollan
  • 153
  • 3
  • 9

3 Answers3

0

It is called attribute concatenation. Your example uses a very specific rule, hard to overwrite. It is a good idea to style the elements by using a tag or class attribute and keep id only for very specific styles.

If you dive a little bit into CSS specificity, you will learn a lot about how to use attributes and what specificity do they have.

You can find a very good explanation with examples here: https://www.smashingmagazine.com/2007/07/css-specificity-things-you-should-know/

n1kkou
  • 3,096
  • 2
  • 21
  • 32
-1

First, decide which you want to use to target, class or ID and use one of the options below:

  • ID you target with "#": #activity-post-container
  • Class you target with ".": .adv_post_container
lehel
  • 431
  • 4
  • 10
-1

You can use any of these, ID and Class. "#" If You Target Your ID #activity-post-container or "." If You Target Your Class .adv_post_container

Saurabh
  • 774
  • 5
  • 15