Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/380.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 保持无序列表对齐_Javascript_Html_Css - Fatal编程技术网

Javascript 保持无序列表对齐

Javascript 保持无序列表对齐,javascript,html,css,Javascript,Html,Css,我正在学习一门关于JavaScript的Udacity课程。主要项目是一份简历,由讲师提供的基本框架构建而成,作为GitHub repo。以下是我最新版本的屏幕截图: 如您所见,我的技能列表在到达图片底部后移到左侧。我想让整个项目符号列表与前两个列表项保持一致。我该怎么做?是否可以使用正确的或我需要 以下是相关代码: index.html <html> <head> <meta charset="utf-8"> <title>Resume

我正在学习一门关于JavaScript的Udacity课程。主要项目是一份简历,由讲师提供的基本框架构建而成,作为GitHub repo。以下是我最新版本的屏幕截图:

如您所见,我的技能列表在到达图片底部后移到左侧。我想让整个项目符号列表与前两个列表项保持一致。我该怎么做?是否可以使用正确的
或我需要

以下是相关代码:

index.html

<html>
<head>
  <meta charset="utf-8">
  <title>Resume</title>

  <link href="css/style.css" rel="stylesheet">
  <meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
  <div id="main">
    <div id="header" class="center-content clear-fix">
      <ul id="topContacts" class="flex-box"></ul>
    </div>
    <div style="clear: both;"></div>
    <div id="workExperience" class="gray">
      <h2>Work Experience</h2>
    </div>
    <div id="projects">
      <h2>Projects</h2>
    </div>
    <div id="education" class="gray">
      <h2>Education</h2>
    </div>
    <div id="mapDiv">
      <h2>Where I've Lived and Worked</h2>
    </div>
    <div id="lets-connect" class="dark-gray">
      <h2 class="orange center-text">Let's Connect</h2>
        <ul id="footerContacts" class="flex-box">
      </ul>
    </div>
  </div>

  <script src="js/jQuery.js"></script>

  <script src="js/helper.js"></script>

  <script src="js/resumeBuilder.js"></script>

  <script>
    if(document.getElementsByClassName('flex-item').length === 0) {
      document.getElementById('topContacts').style.display = 'none';
    }
    if(document.getElementsByTagName('h1').length === 0) {
      document.getElementById('header').style.display = 'none';
    }
    if(document.getElementsByClassName('work-entry').length === 0) {
      document.getElementById('workExperience').style.display = 'none';
    }
    if(document.getElementsByClassName('project-entry').length === 0) {
      document.getElementById('projects').style.display = 'none';
    }
    if(document.getElementsByClassName('education-entry').length === 0) {
      document.getElementById('education').style.display = 'none';
    }
    if(document.getElementsByClassName('flex-item').length === 0) {
      document.getElementById('lets-connect').style.display = 'none';
    }
    if(document.getElementById('map') === null) {
      document.getElementById('mapDiv').style.display = 'none';
    }
  </script>
</body>
</html>
css/styles.css

body,
div,
ul,
li,
p,
h1,
h2,
h3,
h4,
h5,
h6 {
  padding: 0;
  margin: 0;
  font-family: "Roboto", sans-serif;
}

.clear-fix {
  overflow: auto;
}

.education-entry,
.work-entry,
.project-entry {
  padding: 0 5%;
}

h1 {
  font-size: 40px;
  color: #f5a623;
  line-height: 48px;
  display: inline;
}

h2 {
  font-weight: bold;
  font-size: 24px;
  color: #999;
  line-height: 29px;
  padding: 10px;
}

h3 {
  font-style: italic;
  font-size: 20px;
  color: #000;
  line-height: 22px;
}

h4 {
  font-weight: bold;
  font-size: 14px;
  color: #4a4a4a;
  line-height: 17px;
}

h2,
h3,
h4,
h5 {
  padding: 10px 5%;

}


.date-text {
  font-style: italic;
  font-size: 14px;
  color: #999;
  line-height: 16px;
  float: left;
}

.location-text {
  font-style: italic;
  font-size: 14px;
  color: #999;
  line-height: 16px;
  float: right;

}

p {
  font-size: 14px;
  color: #333;
  line-height: 21px;
}

a {
  color: #1199c3;
  text-decoration: none;
  margin-top: 10px;
  display: block;
}

.welcome-message {
  font-style: italic;
  font-size: 18px;
  color: #f3f3f3;
  line-height: 28px;
}

#skills-h3 {
  color: #f5ae23;
  display: none;
}

.orange {
  background-color: #f5ae23;
}

.orange-text {
  color: #f5ae23;
}

.white-text {
  font-weight: bold;
  color: #fff;
}

.gray {
  background-color: #f3f3f3;
  padding-bottom: 10px;
  clear: both;
}

.dark-gray {
  background-color: #4a4a4a;
}

/* TODO: Replace with image later */
#header {
  background-color: #484848;
}

.flex-box {
  display: -webkit-flex;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-around;
  padding: 10px;
}

.flex-column {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  padding: 10px;
}

.center-content {
  padding: 2.5% 5%;
}

ul {
  list-style-type: none;
}

.biopic {
  float: left;
  padding: 10px;
  width: 200px;
  display: none;
}

img {
  padding: 10px;
}

span {
  padding: 5px;
}

#lets-connect {
  text-align: center;
}

/* Media queries to handle various device widths */

@media only screen and (max-width: 1024px) {
  #lets-connect {
    margin-top: 5%;
  }
}

@media only screen and (max-width:900px) {
  .biopic {
    width: 175px;
  }
}

@media only screen and (max-width: 750px) {
  #lets-connect {
    margin-top: 10%;
  }
  .biopic {
    width: 150px;
  }
  .welcome-message {
    display: none;
  }
}

#map {
  display: block;
  height: 100%;
  margin: 0 5%;
}

#mapDiv {
  height: 400px;
  width: 100%;
  padding-bottom: 5%;
}

@media only screen and (min-width: 750px) {
  #skills-h3,
  .biopic {
    display: block;
  }
}
js/helper.js

var HTMLheaderName = '<h1 id="name">%data%</h1>';
var HTMLheaderRole = '<span>%data%</span><hr>';

var HTMLcontactGeneric = '<li class="flex-item"><span class="orange-text">%contact%</span><span class="white-text">%data%</span></li>';
var HTMLmobile = '<li class="flex-item"><span class="orange-text">mobile</span><span class="white-text">%data%</span></li>';
var HTMLemail = '<li class="flex-item"><span class="orange-text">email</span><span class="white-text">%data%</span></li>';
var HTMLtwitter = '<li class="flex-item"><span class="orange-text">twitter</span><span class="white-text">%data%</span></li>';
var HTMLgithub = '<li class="flex-item"><span class="orange-text">github</span><span class="white-text">%data%</span></li>';
var HTMLblog = '<li class="flex-item"><span class="orange-text">blog</span><span class="white-text">%data%</span></li>';
var HTMLlocation = '<li class="flex-item"><span class="orange-text">location</span><span class="white-text">%data%</span></li>';

var HTMLbioPic = '<img src="%data%" class="biopic">';
var HTMLwelcomeMsg = '<span class="welcome-message">%data%</span>';

var HTMLskillsStart = '<h3 id="skills-h3">Skills at a Glance:</h3><ul id="skills" class="flex-column"></ul>';
var HTMLskills = '<li class="flex-item"><span class="white-text">%data%</span></li>';
var HTMLheaderName='%data%';
var HTMLheaderRole='%data%
'; var HTMLcontactGeneric='
  • %contact%%data%
  • '; var HTMLmobile='
  • mobile%data%
  • ; var HTMLemail='
  • 电子邮件%data%
  • ; var HTMLtwitter='
  • twitter%data%
  • ; var HTMLgithub='
  • github%data%
  • ; var HTMLblog='
  • blog%data%
  • ; var htmlocation='
  • 位置%data%
  • ; var HTMLbioPic=''; var HTMLwelcomeMsg='%data%'; var htmlskillssstart='一目了然的技能:
      ; var HTMLskills='
    • %data%

    • 尝试将
      清除:两个
      都添加到图像标记中,以便列表不会移动到图片底部。

      检查生成页面中的HTML元素后,我发现我没有正确地将每个技能的
    • 标记插入
      HTMLSkillssStart
      中定义的
      标记中。我只是需要换衣服

      $("#header").append(formattedSkills);
      


      如果我理解正确的话,
      .biopic
      CSS选择器中会出现这种情况?是的,图像标签中提到的类。
      $("#header").append(formattedSkills);
      
      $("#skills").append(formattedSkills);