1
我已成功在本網站的簡歷部分存儲PDF對象。但是,我試圖將對象的頂部(在本例中爲PDF查看器)與標題的底部(在即將顯示的屏幕截圖中用灰線表示)對齊。我一直在Object的頂部和header的底部之間留下空白,如screenshot所示。將對象與標題底部對齊
這裏是有問題的主體部分的HTML:
<body>
<header>
<a href="index.html" id="logo"> <h1>
<div id="header_title">
Title
</div></h1> </a>
<div id="header_border"></div>
<nav id="nav">
<ul>
<li>
<a href="index.html" class="selected" >About</a>
</li>
<li>
<a href="resume.html">Resume</a>
</li>
<li class="subNav">
<a>Portfolio</a>
<ul>
<li>
<a href="writing_samples.html">Writing Samples</a>
</li>
<li>
<a href="photoshop.html">Photoshop</a>
</li>
</ul>
</li>
<li>
<a href="contact.html">Contact</a>
</li>
</ul>
</nav>
</header>
<object id="resume" data="img/Resume.pdf" type="application/pdf" style="float: left" width="100%" height="100%">
<p>
It appears you don't have a PDF plugin for this browser.
No biggie... you can <a href="myfile.pdf">click here to
download the PDF file.</a>
</p>
</object>
</body>
和CSS:
html {
height: 100%;
}
body {
font-family: 'Playfair Display', open sans;
height: 100%;
}
#wrapper {
max-width: 940px;
margin: 0 auto;
padding: 0 5%;
}
a {
text-decoration: none;
}
img {
max-width: 100%; /* images fill width of parent container
image will shrink with size of container */
}
h3 {
margin: 0 0 1em 0;
}
/************************
HEADING
*************************/
header {
position: relative;
float: left;
margin: 0 0 30px 0; /* top, right, bottom, left */
padding: 5px 0 0 0; /* ibid */
width: 100%; /* since floated, this element does not have an
explicit width; therefore, it must be assigned to 100%
of page*/
}
#logo {
text-align: center;
margin: 0;
}
h1 {
font-family: 'Playfair Display', open sans;
/* font-size: 100px; font-size is overruled in responsive.css
for computer screens set in min-width 660*/
margin: 85px 0;
font-weight: normal;
/* font-weight: normal; will unbold the headline, as headlines
are set to bold by default. */
line-height: 0.8em;
}
#header_title {
position: absolute;
bottom: 0;
left: 50px;
padding: 10px 0;
}
#header_border {
width: calc(95% - 70px);
position: absolute;
bottom: 0;
margin-left: 50px;
border-bottom: 2px solid #dddede;
}
/************************
NAVIGATION
*************************/
nav {
position: absolute;
bottom: 0;
right: 0;
padding: 10px 0;
}
nav ul {
list-style: none;
margin: 0 10px;
padding: 0;
}
nav > ul > li { /* only impacts the first list items; keeps About, Portfolio, Contacts in horizontal line*/
display: inline-block;
position: relative;
}
nav > ul> li> a {
font-weight: 800;
padding: 15px 10px;
}
nav > ul > li.subNav ul > li> a {
}
nav > ul > li.subNav ul { /* now free to style/block secondary list*/
display: none;
position: absolute;
top: 100%;
left: 0;
white-space: nowrap;
background: pink;
}
nav ul li.subNav:hover ul {
display: block;
text-align: left;
}
/***********************
* BODY
*/
#resume {
height: 100%;
width: 100%;
}
嘗試'垂直對齊:頂部;' –