0

I want to style the text selected in chrome tools in below screenshot, how can I do that?

The text doesn't fall under any div to select, that confuses me.

More precisely the text in given screenshot has no div: "The elements of the C language library are also included as a subset of the C++ Standard library. These cover many aspects, from general utility functions and macros to input/output functions and dynamic memory management functions:"

Text without any "div"

Update 1: Screenshot is from http://www.cplusplus.com/reference/. Class "C_doc" will affect whole div including h1 and others. I just want to affect the plain text.

Update 2: It will be hard for CSS alone, may be javascript can bring some magic to select that node and manipulate it's class.

igauravsehrawat
  • 3,696
  • 3
  • 33
  • 46

4 Answers4

1

The text falls under the div which has the class C_doc.

hkasera
  • 2,118
  • 3
  • 23
  • 32
  • But whole class "C_doc" will be affected. I want to style the text in class "C_doc". – igauravsehrawat Mar 21 '16 at 07:15
  • Textnode can't be styled standalone. To add the css for them they need a wrapper on top. So you have two options - Wrap the text you are targetting under a span tag and style this tag or Apply style to the class C_doc with the styles and override the style of other elements like h1, etc. – hkasera Mar 21 '16 at 08:13
  • Thanks, but may be javascript can do some magic in manipulating the textnode. As mentioned earlier screenshot is from http://www.cplusplus.com/reference/ and I have not coded this up. – igauravsehrawat Mar 21 '16 at 08:20
0

Lot of html will not use . Especially html that has been crafted be hand or generated by tools that are not targetting modern web pages.

You have to refer to the enclosing element (dic class=C_doc") in the specific example case). And take care for treating any enclosed elements that should get different styling.

rpy
  • 3,953
  • 2
  • 20
  • 31
0

The text is under the <div class="C_doc"> so if you want to style the text just add your CSS styling to the class but remember it may affect your H1, H3 and other div tag inside the div.

0

Why can't you wrap the content with a P tag? Anyway the current content belongs to the DIV which has a class of "C_doc". You can add style to this class. You can avoid these changes to be reflected to your H tags by adding nested styes.

.C_doc { color:red;}
.C_doc h1 { color:black}
babtech
  • 159
  • 3
  • 5
  • 12
  • Screenshot is from http://www.cplusplus.com/reference/. I don't want everything in "C_doc" class to be affected, just the plain text. – igauravsehrawat Mar 21 '16 at 07:19