【发布时间】:2016-08-25 00:34:14
【问题描述】:
最近我一直在使用 HTML 创建几个设计,然后将它们链接到 CSS 文件。
我遇到的问题是我上传这些设计的网站不允许<div> 标签。我可以将设计作为图片上传,但我想使用我用 html 而不是 photoshop 设计的设计。
所以我想弄清楚如何将我的 css 转换为我的 html,因为它不允许 <div> 标签。
我尝试通过<style> 标签将我的 CSS 直接插入到我的 html 文件中,但没有读取它。如果我将<div> 更改为<p>,那么它确实有效。我也尝试过使用 CSS 内联转换将 css 更改为 html,但这也不起作用。
所以基本上,我必须弄清楚如何转换我的整个简历,以便将 css 转换为样式属性。
这是我创建的一些示例代码:
body, div, h1, h2, h3, h4, h5, h6, p, ul, ol, li, dl, dt, dd, img, form, fieldset, input, textarea, blockquote {
margin: 0; padding: 0; border: 0;
background: #fffff url(images/bg.png);
font: 19px Helvetica, Arial, Sans-Serif;
color: black;
line-height: 24px;
background-position: center top;
}
body {
min-width: 800px;
}
#content {
background-color: #b8e5f6;
margin: 0 auto;
width: 900px;
height: 600px;
margin-top: 10px;
margin-bottom: 30px;
border-radius: 65px;
}
#content {
position: relative;
}
#content-desc {
position: relative;
top: 230px;
left: 64px;
width: 370px;
height: 100px;
}
#Ocean {
position: relative;
background-color: #004a80;
margin: 0 auto;
width: 900px;
height: 70px;
margin-top: 270px;
}
#Sand {
position: relative;
background-color: #f8cc61;
margin: 0 auto;
width: 900px;
height: 160px;
border-bottom-right-radius:65px;
border-bottom-left-radius:65px;
}
#Amazon {
position: absolute;
margin: 0 auto;
margin-bottom: 10px;
width: auto;
top: 470px;
left: 80px
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> Bio </title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="content">
<div id="content-desc">
<p> A bunch of random text I've added for example purposes. </p>
</div>
<div id="Ocean"></div>
<div id="Sand"></div>
<div id="Amazon">
<a href="https://www.amazon.co.uk" target="_blank" rel="nofollow"><img id="amazon" src="http://i.imgur.com/2vj7NAr.png" alt="Header" height="30%" width="30%"></a>
</div>
</div>
</body>
我已经玩了几个小时了,但我运气不佳,因为我对 html 编码还很陌生。尤其是让不同的框和文本在没有<div> 标签的情况下相互叠加。
我也习惯使用绝对定位来放置我的文本和图像,而相对定位有点棘手。
是否有人可以为上述示例代码指出正确的方向,以便我可以学习如何转换我的其余设计?
谢谢。
【问题讨论】: