p::first-letter background: darkblue; : p.first letter « Tags « HTML / CSS






p::first-letter background: darkblue;

     

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>
    <head>
        <title>Pseudo-Element Selectors</title>
<style type='text/css'>
p {
    color: darkblue;
    border: 1px solid lightblue;
    padding: 2px;
    font: 14px sans-serif;
}
p.quote::first-letter {
    background: darkblue;
    color: white;
    font: 55px "Monotype Corsiva";
    float: left;
    margin-right: 5px;
}
p.quote::first-line {
    font-weight: bold;
    letter-spacing: 3px;
}
p.byline {
    text-align: right;
    font-style: italic;
    font-size: 10px;
    border: none;
}
</style>


    </head>
    <body>
        <p class='quote'>
            You see, wire telegraph is a kind of a very, very long cat.
            this is a test
            this is a test
            this is a test
            this is a test
            this is a test
            this is a test
            
        </p>
        <p class='byline'>
            - Albert Einstein
        </p>
    </body>
</html>

   
    
    
    
    
  








Related examples in the same category

1.p:first-letter font-size: 1.2em;
2.p:first-letter background-color: black;
3.p:first-letter color: white;
4.p:first-line font-weight: bold;
5.p:first-line font-size: 2em;
6.p:first-line background-image: url(http://java2s.com/style/logo.png);
7.p:first-letter font-size:32px;
8.p:first-letter font-weight:bold;
9.p:first-line font-size:18px;
10.p:first-line font-weight:bold;
11.p.className::first-letter
12.p.className::first-line
13.p::first-letter color: white;
14.p::first-letter font: 55px "Monotype Corsiva";
15.p::first-letter float: left;
16.p::first-letter margin-right: 5px;
17.p::first-line font-weight: bold;
18.p::first-line letter-spacing: 3px;
19.p:first-letter font-size: 200%;
20.p:first-letter font-weight: bold;
21.p:first-line font-size: 200%;
22.p::first-letter background: crimson;
23.p::first-letter color: pink;
24.p:first-letter font-size:32px; font-weight:bold;
25.p:first-child background: moccasin;
26.p:first-child border: 1px solid tan;
27.This paragraph uses the first-letter pseudo-element to change the appearance of the first letter in the paragraph.
28.Sink First Letter of a paragraph
29.p::first-letter font-size: 200%;background-color: lightgray;border: 1px solid black;
30.p::first-letter
31.Set the style for first line of P
32.first line pseudo-class
33.drop caps with p:first-letter
34.p#dropcap:first-letter
35.p#initialcap:first-letter
36.p::first-letter font: 120% "Monotype Corsiva"