0

This is my code, contained within the snippet, run to see how the HTML looks:

<!DOCTYPE html>
<html lang="en-US">

<head>
  <title>Used Car Guide - Autoweekly on localhost</title>
</head>
<style>
  body {
    font-family: Verdana, sans-serif;
    font-size: 12px;
  }
  
  p {
    font-size: 12px;
    line-height: 18px;
  }
  
  h2 {
    page-break-after: always;
  }
  
  table {
    border: 1px solid black;
    width: 130%;
  }
  
  td,
  tr {
    font-family: Verdana, sans-serif;
    font-size: 12px;
    line-height: 14px;
  }
  
  div {
    width: 340px;
    height: auto;
  }
  
  div.news {
    width: 400px;
    height: auto;
    line-height: 22px;
  }
  
  div.news img {
    height: 221px;
    width: 347px;
    float: left;
  }
  
  div.autocarguide {
    width: 600px;
    height: auto;
    line-height: 30px;
  }
  
  div.autocarguide p {
    font-family: Verdana, sans-serif;
    font-size: 14px;
    line-height: 18px;
  }
  
  div.autocarguide h4>p {
    font-family: Verdana, sans-serif;
    font-size: 14px;
    line-height: 18px;
  }
  
  div.autocarguide tr,
  td {
    font-family: Arial, sans-serif;
    font-size: 15px;
  }
  
  div.autocarguide img {
    width: 430px;
    height: auto;
    margin: 20px;
    position: relative;
  }
  
  div.autocarguide img.auto {
    width: 320px;
    height: auto;
    margin: 20px;
    float: right;
    position: relative;
  }
</style>


<div class="autocarguide">
  <H2>Audi A8 sedan (2003-2010)</H2>
   <p><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/33/2003-2005_Audi_A8_%284E%29_4.2_quattro_sedan_%282011-01-05%29.jpg/420px-2003-2005_Audi_A8_%284E%29_4.2_quattro_sedan_%282011-01-05%29.jpg"></p>
  <p>Long a favorite full-size sedan of ours, the 2003-2010 generation of Audi A8 was one of our Car of the Year Runners-up, and a recommended car for 2007, 2008 and 2010. It's a worthwhile buy, especially in the L long-wheelbase models, which are well worth
    a test drive. However, the quattro sedan is awesome too, if you don't want a Range Rover, the <em>de facto</em> luxury choice for many, and want an all-weather full-size sedan.</p>
  <p>
    <h4>Performance</h4>
    We got a choice of three petrol engines; a 3.2-litre/252hp V6 engine, a 3.7-litre/276hp V8 engine, along with a 4.2-litre/335hp V8 petrol. These used Volkswagen-Audi Group's FSI technology gasoline-direct injection technology. They were badged aa 3.2
    FSI, 3.7 FSI and 4.2. Europeans got a wider range of engines, so no fuel-sipping 2.8-litre/207hp V6 or the later 3.0-litre/217hp V6 engines for us. The larger, faster V8, V10 and W12 FSI turbos wouldn't arrive until later.</p>
  <table>
    <tr>
      <td>3.2 FSI 4dr sedan</td>
      <td>6sp Automatic</td>
      <td>TBC</td>
    </tr>
    <tr>
      <td>3.7 FSI 4dr sedan</td>
      <td>6sp Automatic</td>
      <td>TBC</td>
    </tr>
    <tr>
      <td>4.2 FSI quattro 4dr sedan</td>
      <td>6spd Automatic</td>
      <td>TBC</td>
    </tr>
    <tr>
      <td>A8 L 3.7 FSI 4dr sedan</td>
      <td>6sp Automatic</td>
      <td>TBC</td>
    </tr>
    <tr>
      <td>A8 L 4.2 FSI quattro 4dr sedan</td>
      <td>6spd Automatic</td>
      <td>TBC</td>
    </tr>
  </table>
</div>

What I am trying to do is make the text after the tag a certain font within the div, but it has not worked, although the line-height has changed.

My code snippet is a sample of an existing page I've got running on http://127.0.0.1, on AMPPS on Mac OS Sierra 10.12.2, Mac mini 2011, and it's pure HTML for testing the design of a site.

I tried h4+p, but that didn't work out, no change in font. I modified it to h4 > p as a selector, but again, no real change in font size after the h4 element.

I'm not sure what I did wrong with this, though, being new to CSS selectors. This is a page designed by hand, and created by me, so it's clean-slate design using my own basic knowledge.

I would appreciate any help, as I'm new-ish to CSS selectors.

avenas8808
  • 1,639
  • 3
  • 20
  • 33
  • You can't target that text with the markup you have, you'd have to set the font-size of the `p` and then overwrite the size in the `h4`. The simplest thing to do would be to wrap it in a `` and then you can use `p > span` or `h4 + span`. – skyline3000 Jul 21 '18 at 12:05

1 Answers1

0

Your <H4> is nested within <p>. This is not the intended use of header tags.

Change you HTML to

  <h4>Performance</h4>
  <p>We got a choice ...

and you will get the intended behavior of your CSS styles.

Marcel
  • 1,688
  • 1
  • 14
  • 25