提问者:小点点

为什么我的段落不向左对齐?


我希望段落向左对齐

我的HTML或CSS有问题吗?

<ul class="imp">
    <h2 <li>Born: August 11, 1967 (age 53 years), Newark, New Jersey, United States </li> </h2>
    <h2 <li>Height: 1.71 m </li></h2>
    <h2 <li>Children: 2 </li></h2>
    <h2 <li>Spouse: Jessica Ditzel (m. 2009)</li></h2>
<ul/>

<div>
    <p><h2>He has also worked as a television host and an actor. Rogan began his career in comedy in August 1988 in the Boston area. After relocating to Los Angeles in 1994, he signed an exclusive developmental deal with Disney, and appeared as an actor on several television shows including Hardball and NewsRadio. In 1997, he started working for the Ultimate Fighting Championship (UFC) as an interviewer and color commentator. Rogan released his first comedy special in 2000. From 2001 to 2006, he was the host of Fear Factor. In 2009, Rogan launched his podcast The Joe Rogan Experience, which led him to "fame, wealth and podcast superstardom".</h2></p>
</div>

CSS代码:

.imp {
    padding: 0px;
    text-align: left;
    font-family: 'Roboto', sans-serif;
    font-weight: 900;
}
.para {
    padding: 0px;
    margin-left: 0px;
    text-align: left;
    font-family: 'Roboto', sans-serif;
    font-weight: 900;
}

共1个答案

匿名用户

它应该是一个评论,但我看到你是一个新手,所以我想回答更多的细节。

  • 文本左对齐为默认值
  • 如果使用listulli应该指向子标记,而不是其他标记。
  • 不应换行标题h2

  • CSS中的
  • 类应通过...
  • 应用于HTML

基本上,你的HTML是错误的,而不是CSS。