I'm trying to overlap the text over the div below it. The problem is that I need it all in the bottom right of the page so it already has position: absolute.
This is what I currently have.
And this is what I'm trying to make it look like:
https://jsfiddle.net/7ow5p192/
body {
background-color: black;
}
.title {
color: white;
text-align: left;
}
.artist {
color: black;
font-size: 60px;
line-height: 60px;
}
.artist-container {
text-align: left;
width: 100%;
background-color: white;
display: block;
}
.nameContain {
font-weight: bold;
position: absolute;
display: block;
right: 0;
bottom: 0;
max-width: 50%;
font-size: 50px;
}
.nameContain2 {
position: relative;
}
<div class="nameContain">
<span class="title">Smells Like Teen Spirit</span>
<div class="artist-container"><span class="artist">Nirvana</span></div>
</div>
A simple text-align: right should do the trick.
body {
background-color: black;
}
.title {
color: white;
}
.artist {
color: black;
font-size: 60px;
line-height: 60px;
}
.artist-container {
width: 100%;
background-color: white;
display: block;
}
.nameContain {
font-weight: bold;
position: absolute;
display: block;
right: 0;
bottom: 0;
max-width: 50%;
font-size: 50px;
text-align: right;
}
<div class="nameContain">
<span class="title">Smells Like Teen Spirit</span>
<div class="artist-container"><span class="artist">Nirvana</span></div>
</div>
Related
I am currently working on a website and I have an element that I have explicitly declared: display: inline-block and visibility: visible however, the element is still invisible. This is only occurring on mobile devices. The invisible element is <div id="clock">.
#font-face {
font-family: 'bitwise';
src: url('bitwise.ttf');
font-display: swap;
}
* {
font-family: 'bitwise', monospace;
margin: 0;
padding: 0;
outline: 0;
}
:root {
background-color: #008080;
}
body,
html,
.wrapper {
width: 100%;
height: 100%;
}
span {
color: #FFFFFF;
font-size: 18pt;
text-align: center;
display: inline-block;
}
h1 {
color: #FFFFFF;
text-align: center;
display: inline-block;
}
input {
font-family: 'bitwise', monospace;
background-color: #535353;
color: #FFFFFF;
font-size: 18pt;
overflow: hidden;
text-align: center;
line-height: inherit;
height: inherit;
}
img:not(.noresize) {
width: 35%;
height: 35%;
}
video {
width: 35%;
height: 35%;
}
a:link {
color: #EFCF7C;
}
a:visited {
color: #105733;
}
button {
background-color: #105733;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 18px;
margin: 4px 2px;
}
#back {
background-color: #660000;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 18px;
margin: 4px 2px;
}
#taskbar {
position: absolute;
overflow: hidden;
bottom: 0;
width: 100%;
height: 27px;
background-color: silver;
box-shadow: inset 0px 1px #dfdfdf, inset 0px 2px #ffffff;
}
.center {
display: flex;
flex-wrap: wrap;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
text-align: center;
align-items: center;
justify-content: center;
}
#start {
float: left;
}
#clock {
float: right;
position: relative;
text-align: center;
}
#clocktime {
font-family: 'Arial', serif;
font-size: 13px;
color: #000000;
position: relative;
bottom: 23px;
left: 17px;
}
#icons {
padding-top: 8px;
}
#content {
padding-top: 10px;
}
.break {
flex-basis: 100%;
height: 0;
}
#content {
width: 675px;
height: 300px;
}
#media screen and (max-width: 1079px) {
html,
body {
overflow: hidden;
}
#clock {
float: right;
position: relative;
bottom: 100px;
text-align: center;
display: inline-block;
visibility: visible;
}
#clocktime {
font-family: 'Arial', serif;
font-size: 13px;
color: #000000;
position: relative;
bottom: 23px;
left: 17px;
}
}
<div id="taskbar">
<div id="start"><img class="noresize" src="/assets/start.png"></div>
<div id="clock"><img class="noresize" src="/assets/clock.png">
<div id="clocktime"></div>
</div>
</div>
<div id="icons"><img class="noresize" src="/assets/icons.png"></div>
<div class="center"><img class="noresize" src="/assets/ie.png"></div>
<div class="center" id="content">
Content here.
</div>
Screenshot 1 - What the page should look like. Note the clock in the lower-right corner.
Screenshot 2 - What the page actually looks like on mobile.
Screenshot 3 - Chrome DevTools showing the element as being in a visible spot, but still not being visible.
I see that that css is only appliable when max-width is equal to 1079px.
Try to increase that number in inspector element to see what happens.
So it turns out I had overflow: hidden set on #taskbar and this means that any children inside of the taskbar will not display, even if they are in a "visible" area. Adding bottom: 32px to set it inside of the taskbar worked.
Updated CSS:
#taskbar {
position: absolute;
overflow: hidden;
bottom: 0;
width: 100%;
height: 27px;
background-color: silver;
box-shadow: inset 0px 1px #dfdfdf, inset 0px 2px #ffffff;
}
<snip>
#media screen and (max-width: 1079px) {
#clock {
bottom: 32px;
}
}
This question already has an answer here:
Why do I have scroll bars on my website when there shouldn't be?
(1 answer)
Closed 1 year ago.
I'm making a discord server website for people to find discord servers to join and make
friends but, I dont know why my web page has a horizontal scroll bar. It also had a vertical scroll
bar but I got rid of that,
anyway here is my HTML and CSS
html {
font-family: Arial, Helvetica, sans-serif;
background-color: #414141;
text-decoration: none;
}
body {
background-color: #414141;
}
:root {
--navbar-height: 4rem;
--header-height: 14rem;
--main-min-height: 240rem;
}
body {
height: 100vh;
min-width: 480;
margin: 0;
padding: 0;
font-family: Helvetica;
display: grid;
grid-template-rows: minmax(var(--navbar-height), auto) minmax(var(--main-min-height) 1fr) auto;
}
.topnav {
overflow: hidden;
padding: 0px 15px;
height: var(--navbar-height);
color: white;
}
.topnav a {
font-size: 20;
float: left;
color: #f2f2f2;
text-align: center;
padding: 22px 16px;
text-decoration: none;
font-size: 17px;
}
.topnav a:hover {
background-color: #ddd;
color: black;
}
.topnav a.active {
color: #788ce2;
}
.topnav-right {
float: right;
}
.row::after {
clear: both;
display: table;
}
.copyright {
position: absolute;
bottom: 1%;
right: 1%;
font-size: 15px;
}
.copyright-text {
color: white;
}
.footer-links {
position: absolute;
bottom: 5%;
}
.link-text {
position: absolute;
bottom: 10%;
color: white;
text-decoration: none;
}
.container {
padding: 0;
margin: 0;
}
li {
position: relative;
left: 100%;
}
footer {
position: absolute;
bottom: 0%;
height: 300px;
width: 100%;
color: #fff;
background: #2c2c2c;
}
.welcome {
margin-top: -2.5rem;
width: 100%;
height: 35.5rem;
line-height: 1.8em;
margin-bottom: .4em;
padding: 0;
font-family: Helvetica;
font-weight: 600;
font-size: 1.5em;
color: #ffff;
text-transform: uppercase;
}
.centered-text {
position: relative;
margin-left: 25%;
display: flex;
align-items: center;
padding: 0 1.5rem;
}
.discord-logo {
border: 0;
font: 0/0 a;
text-shadow: none;
color: transparent;
display: inline-block;
padding: .6em 0;
background: url(images/Discord-Wordmark-White.png) center no-repeat;
background-size: contain;
font-size: 1em;
}
.head {
margin-bottom: .4em;
padding: 0;
line-height: 1.4;
font-weight: 600;
font-size: 2em;
}
.body {
position: relative;
margin-left: 24.5%;
margin: 0 auto 1em;
text-transform: inherit;
opacity: 85%;
}
.search-box {
position: absolute;
top: 90%;
left: 18%;
background: #2c2c2c;
height: 40px;
border-radius: 40px;
padding: 10px;
}
.search-box:hover>.search-txt {
width: 260px;
padding: 0 6px;
}
.search-btn {
color: white;
float: right;
width: 40px;
height: 40px;
border-radius: 100%;
background: black;
display: flex;
justify-content: center;
align-items: center;
text-decoration: none;
}
.search-box:hover>.search-btn {
background: white;
color: black;
}
.search-txt {
border: none;
background: none;
outline: none;
float: left;
padding: 0;
color: white;
font-size: 16px;
transition: 0.4s;
line-height: 40px;
width: 0px;
}
.navbar-servers {
color: white;
float: right;
}
.title-right {
position: absolute;
right: 25%;
}
body {
color: #e6e6e6;
font-size: 1em;
font-weight: 400;
line-height: 1.5;
}
h1 {
position: absolute;
left: 42%;
top: 10%;
}
.last-modified {
position: absolute;
left: 40.6%;
top: 17%;
}
.terms-of-service-align {
position: absolute;
left: 1%;
top: 25%;
}
.site-footer .site-footer--container,
.site-footer .site-footer--extra {
max-width: 1264px;
width: 100%;
margin: 0 auto;
padding: 32px 12px 12px 12px;
display: flex;
flex-flow: row wrap;
}
.site-footer--container,
.site-footer--extra {
max-width: 1264px;
}
.site-footer,
.site-footer *,
.site-footer *:before,
.site-footer *:after {
box-sizing: border-box;
}
h5,
h6 {
margin: 0;
padding: 0;
border: 0;
font: inherit;
font-size: 100%;
vertical-align: baseline;
}
.site-footer {
background-color: #242729;
background-image: none;
background-position: top left;
background-repeat: no-repeat;
border-top: 0;
background-size: auto;
color: #6a737c;
padding-top: 0;
padding-bottom: 0;
}
.discord {
color: #788ce2;
font-weight: 800;
}
.guidelines {
color: #788ce2;
font-weight: 800;
}
.hidden {
position: absolute;
top: 520%;
height: 0px;
opacity: 0%;
}
.main-header {
position: absolute;
left: 41%;
}
.all {
position: relative;
top: 10%;
left: 28%;
}
<nav class="topnav">
<div>
<h2 class="title-right">
OnTop Servers
</h2>
</div>
</nav>
<div class="main-container">
<h1 class="main-header">
Guidelines</h1>
<p class="last-modified">
Last Modified: 2020-11-22
</p>
<div class="all">
In order to keep a safe community, there are some guidelines which need to be followed by you<br> By using DISBOARD, you agree to the following guidelines:<br><br> The use of swear words, dirty words or NSFW (sexual content) to our discretion in a
server's meta (title,<br> description and picture), review or other content that may be seen by other users in DISBOARD is not<br> allowed. This will lead to the removal of the content, however, you'll be able to repost the content with a<br> proper
language.<br>
<Br> You may not violate any laws or regulations in your country of residence or promote the violation of them.<br><br> Servers violating <a class="discord" href="https://discord.com/guidelines">Discord Community Guidelines</a> are not allowed.<br><br> The use of bots or other scripts to automatically do actions in DISBOARD such as bumping a server ("auto-<br> bump") is not allowed. Bumping, creating reviews and etc. must be done manually.<br><br> You may not list servers which serve for the sole
purpose of redirecting or advertising other servers or have<br> no content (To our discretion).<br><br> You may not reward or force users to do actions in DISBOARD. For instance, you may not reward your users<br> for posting a nice review on a server
or force them to bump a server.<br><br> You may not create multiple Discord accounts to submit multiple reviews. Please just post 1 review per<br> person.
<br><br> All servers which are mainly based on NSFW (sexual content to our discretion) must be marked as "NSFW"<br> in DISBOARD.<br><br>
<div class="TOS">
See also our <a class="discord" href="termsofservice.html">Term of Services</a>
</div>
</div>
How do I fix, please help me with this...
I dont know what to do, I gone through almost everything on the page, I don know.
position: relative; left:28% pushes the element beyond the window width creating an overflow to the right.
.all {
position: relative;
top: 10%;
left: 28%;
}
you can try using padding or margin instead
Instead of putting left: 28% for your div, use padding-left: 28%. It should be a little fix.
I have a site and it has 2 sections. the left section is a navigation bar with menus below.
The section next to it is the main section or where the website content must be placed. My problem is the right section is positioned a few pixels from the header. How can i fix this? I provided some image to let you see how the website should look like.
/*WRITTEN USING SASS*/
#side-menu{
margin-top: 25px;
.side-menu-bg {
width: max-content;
h3 {
position: absolute;
color: white;
padding: 0px 18px;
font-size: 27px;
}
img {
display: -webkit-box;
}
}
.side-nav-bar {
width: 210px;
position: unset;
margin-top: -3px;
display: inline-flex;
z-index: 1;
flex-direction: column;
overflow-x: hidden;
background-color: #ffffff;
a {
display: inherit;
color: #707070;
text-decoration: none;
font-size: 15px;
padding: 10px 18px;
position: relative;
border-bottom: 1px solid #e8e8e8;
}
.active-link{
color: #a40022;
border-bottom: 2px solid #8a001c;
}
}
.right-contents {
float: right;
.title h3 {
font-size: 38px;
}
.body-content {
background-color: #d3d3d3;
height: 1094px;
width: 738px;
}
}
}
<div class="wrapper"> <!--to make contents center-->
<div id="side-menu">
<div class="side-menu-bg">
<h3>KU 스타트업</h3>
<img src="images/bg/bg_03.png">
</div>
<div class="side-nav-bar">
인사말
창업 비전
창업 프로세스
창업부서소개
찾아오시는 길
</div>
<div class="right-contents">
<div class="title">
<h3>인사말</h3>
<div class="body-content">
sample text
</div>
</div>
</div>
</div>
</div>
Add margin: 0 to your h3 tag.. h3 has margin-to and margin-bottom by default. thanks
.right-contents {
float: right;
.title h3 {
font-size: 38px;
margin: 0; /*add this*/
}
.body-content {
background-color: #d3d3d3;
height: 1094px;
width: 738px;
}
<style>
/*WRITTEN USING SASS*/
#side-menu{
margin-top: 25px;
.side-menu-bg {
width: max-content;
h3 {
position: absolute;
color: white;
padding: 0px 18px;
font-size: 27px;
}
img {
display: -webkit-box;
}
}
.side-nav-bar {
width: 210px;
position: unset;
margin-top: -3px;
display: inline-flex;
z-index: 1;
flex-direction: column;
overflow-x: hidden;
background-color: #ffffff;
}
a {
display: inherit;
color: #707070;
text-decoration: none;
font-size: 15px;
padding: 10px 18px;
position: relative;
border-bottom: 1px solid #e8e8e8;
}
.active-link{
color: #a40022;
border-bottom: 2px solid #8a001c;
}
}
.right-contents {
width: 65%;
margin-top: -3px;
display: inline-flex;
.title h3 {
font-size: 38px;
}
.body-content {
background-color: #d3d3d3;
height: 1094px;
width: 738px;
}
</style>
I'm currently developing an application using iOS 10 and Swift 3
The purpose of this application is to make a PDF file with the content of my UIWebview
It doesn’t work and I have to delete theses lines to generate the PDF.
<div>
#Test#
</div>
Otherwise we have a trouble with in my IBAction :
for i in 1...render.numberOfPages {
UIGraphicsBeginPDFPage();
let bounds = UIGraphicsGetPDFContextBounds()
render.drawPage(at: i - 1, in: bounds)
}
The memory increase like if it was an infini loop
The pdf is not generated and I don't understand why.
Does somebody has an idea about this ?
And I don’t understand why ?
If someone has an idea ?
My swift IBAction :
if let contentOpt = self.contentFile {
let fmt = UIMarkupTextPrintFormatter(markupText: contentOpt)
let render = UIPrintPageRenderer()
render.addPrintFormatter(self.webView.viewPrintFormatter(), startingAtPageAt: 0)
let page = CGRect(x: 0, y: 0, width: 595.2, height: 841.8) // A4, 72 dpi
let printable = page.insetBy(dx: 0, dy: 0)
render.setValue(NSValue(cgRect: page), forKey: "paperRect")
render.setValue(NSValue(cgRect: printable), forKey: "printableRect")
let pdfData = NSMutableData()
UIGraphicsBeginPDFContextToData(pdfData, CGRect.zero, nil)
print("Data ", pdfData)
for i in 1...render.numberOfPages {
UIGraphicsBeginPDFPage();
let bounds = UIGraphicsGetPDFContextBounds()
render.drawPage(at: i - 1, in: bounds)
}
UIGraphicsEndPDFContext();
let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
print("PATH => \(documentsPath)")
pdfData.write(toFile: "\(documentsPath)/file.pdf", atomically: true)
}
This is my CSS code :
<style>
.footer {
page-break-after: always;
}
#media print {
body {
-webkit-print-color-adjust: exact !important;
font-size: small;
}
.pageBreak {
page-break-after: always;
color:red;
}
.headerPDF{
width:100%;
height:50px;
}
#containerImageFuelAndMileage{
text-align: center;
margin-top: 1pt;
}
}
.green, .yellow, .red {
z-index: 10;
position: absolute;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
width: 30px;
height: 30px;
}
.green {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADUAAAApCAQAAAA/+6kbAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfgBw0QAAiIJ56tAAAB5klEQVRYw7XX3U7UQBTA8Vk2WVFU0CdgkV0QDfgoRlZDVl8HQ9SIIUYNEZU74o0xxk+MWVGEsMgzoC749QTuNvl70dW225memdKeuWja9OSXtjNnThUql1HkEZej1/KClgGPet6UDwF4zORJFXlIEB6X8qL6eEA0/mPZQgWWiIfHxawpPQTQoZYlVeA+5mgznR20SHKsZAXdE6AnlLKB7spQFt+qwB0BekpJNwOr4fVtBd0WoGc+1EtVaOFxxQFaEKDn/6AoNcq37pKrW0K3BOhFAIWpU13Ix+TX6AgFVBiyw+YF6CWHohn+YYSvsVtDNVkzbgrQK/p7cxSKMl+0t3fLpGbcEKDXHI5nKcrsGlM61DTQ9TQQStFITGsz3ZNyTYDecET/LhTDCU8F8IcLoYQ5AXprgpK/VRy7KkDvzFAwAyXsPIrZg0DButJN9yj2WIAayZCpWrjHewnS10D3WGNArpnR0wqtVNBRGdLtV67YBztItwtX2XOAPnLMDtJv+GPsW0LrHLeFTL3FON8toE8M2kPmNuY0PwRoww1K6pgm+JkAbbpCyc2ZGdtyh6Q+8Ay/NFAzDSS3nGdjWJOhNJBNdzsZwbbTQnaN9BS/u9BnTqSFbHt2H9vhZHrI/vfgHKsHg1B/AXlXUdOz+ocUAAAAAElFTkSuQmCC) #14c77c no-repeat center !important;
background-size: 20px 14px !important;
}
.yellow {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAA2CAQAAAArUtIRAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfgBw0QAR384UsHAAAD80lEQVRYw7WYT2xURRzHv+xz1bRgu8VWQKmlAoJBQ1Ir5YIJQYPEqISDGKNGEyEhMbGamKgc9IInEvVgjEJFS5EYL+pBjCFiyQYoAokNLdADqcHEiHZZirWxsB8Pu52d9968t+816bzDvp3fbz7fmd/On9+sUIqnh7tS+Qulcx/lb7bMrgDAHubOrgCM8NDsCsAUO/FmUwCgn7trt5mDEpQmrdUqtel51fnqi9qhAzXa1uhBOzs5Q4no0sdtMw3ROr7jBrXLRRanF7iXbxKgAQpsTTuCDN1MJMQfoTXtLMpxyNnPQ3xIwVf3H2+SSTtNWzkXQF9mN2sqIHuanqcz/TpYwsUA/BXqnOvgE+rTr+RmRnz4PTQ6F9plnkq+OKuvWfIWfMI5N0aBH1mUHG8L7PL9pGuc7hd4jTlp8FWBLq4b/DgdEe5tMSiP9miBDCcNvsQT6fpYwfcw5upY+eM5Kzy7Z4TfVwlth0sgw5DBj3DLjPFliQfDApus/m+eAf5z3+S+4pcQ4ktjPJt2juDxRWhbOewXuJV/jGlbanxvCP8LOb/Aemvzmh9C5GLG5LE/hD8ZXP3iXWM8GkLcwRCfRkh49NXGI/G1Me8KGBdUZtdeh4THAQe+wbUOBo3DswH8sLHsDez7njUxpssJFx6Jv4zLOsuw0MID9FgSHgeT4tFNajQJxhUr2XhfK3zJx4uSXtYNSZ769HQgNTmujSpa329Wh+olSY2y8ob7LeX5nA718jM8PL4K1R8L9X5p1WiHaK3PqYlTIdQ+Bz7vCM5qYy3KOsWC24RLIgne3nwuZfSbidx9gciOaYNOxaaFeT3mi/10WW7eRjMaNF86Q44FPRIjkdcmXXVauszbsH0WFMk6httoHUZ2Ocq8iC0kwx/G6yWxyEptH3c2cElE4+3dDdqFrAn5bUSTBgZ8+P7YS1R1EzlbPg9eNRUlHoiUOJEQ38aU8Xy7LHA7k6bq+8iGDRwH4OcaOV11pUzROn3of2wN/5kYiWM18Y9apN7yZifEYv411WPcEyNRF4tv4XfDmWRpVUC8ZSkP0hyLiXrqKkEsl/eQLZDlV8s44Dg8az1zOWwRhqfHWnVYwVXL4TzLUuHv9PV+ktXTFttps5WfQpEXEuM38qfVsmSfjX7HbYEL60+RaXD1WR46nd+w7UH37b5RAPzAloh00mMDBwP+Jbr9XuGb/pPq1bxA3TX1K68LGtW4riunBVqpTq1XU8BvQtu1v/ZNf1nE/lmrnGNVmOaOa5bXGU8Fn+QddyCjf7yFfMC1hPCPoq/j8TMkxw7ysX+FnKGbljhGkr9zWvSwurRSS9SsemVVUEGXNKQBHbFO9IjyP6DLBdf+7yKKAAAAAElFTkSuQmCC) #ffaa01 no-repeat center !important;
background-size: 18px 20px !important;
}
.red {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAArCAQAAAAA/GqmAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfgBw0QCiEweu5LAAAAP0lEQVQoz2P8b8AgwoAMrjD83/IfFUQxMWCAUaFhK8TC8ILhHorIF8b/g8JdLQzmKCLtNE6rLAx3GM6iiLwDACVJK/z9gk6AAAAAAElFTkSuQmCC) #c3002f no-repeat center !important;
background-size: 4px 17px !important;
}
.grayBack {
background: #eeeeee !important;
}
.whiteBack {
background: #ffffff !important;
}
body {
position: absolute;
display: inline;
height: 100%;
width: 100%;
margin: 0 !important;
padding: 0 !important;
}
#date {
top: 0;
right: 30px;
position: absolute;
}
</style>
<style>
#header {
position: relative;
display: block;
height: 340px;
width: 100%;
}
#logoNissan {
position: absolute;
z-index: 10;
top: 0;
left: 43px;
width: 129px;
}
#title > span {
position: absolute;
left: 206px;
top: 53px;
font-size: 15px;
font-weight: bold;
color: #343434;
}
#date {
}
#date > div {
line-height: 12px;
}
#date > span:nth-of-type(1) {
}
#date > span:nth-of-type(2) {
margin-left: 30px;
}
#date > span {
display: inline-block;
}
#date > span:nth-of-type(-n+2) {
font-size: 12px;
font-weight: bold;
color: #343434;
}
#date > span:nth-of-type(n+3) {
font-size: 12px;
font-weight: normal;
color: #343434;
}
#gray {
position: absolute;
top: 120px;
height: 190px;
width: 100%;
background: #eeeeee !important;
}
#gray > div {
display: inline-block;
}
#gray > div:nth-of-type(n+1):nth-of-type(-n+6) {
position: relative;
display: inline-block;
vertical-align: middle;
}
#gray > .green {
margin-left: 180px;
}
#gray > div:nth-of-type(n+1):nth-of-type(-n+6):nth-of-type(odd) {
margin-top: 40px;
}
#gray > div:nth-of-type(n+3):nth-of-type(-n+6):nth-of-type(odd) {
margin-left: 20px;
}
#gray > div:nth-of-type(n+1):nth-of-type(-n+6):nth-of-type(even) {
color: #343434;
font-size: 12px;
font-weight: bold;
margin-left: 20px;
margin-top: 35px;
}
#gray > #DealerLine {
left: 206px;
height: 150px;
font-weight: normal;
}
#gray > #DealerLine > span {
color: #343434;
font-size: 14px;
}
#gray > #DealerLine > span:nth-of-type(3) {
top: 10px;
position: relative;
}
#gray > #DealerLine > span:nth-of-type(even) {
margin-left: 20px;
font-weight: bold;
}
#gray > #DealerLine > span:nth-of-type(odd) {
font-weight: normal;
}
#gray > #DealerLine > div {
line-height: 10px;
}
</style>
<style>
.marginContainer{
margin-top: 6px;
}
#descriptionLineColor {
width: 951px;
}
#custDetail {
position: relative;
display: block;
width: 100%;
height: 305px;
margin-top: 25px;
}
#custTitle {
position: absolute;
left: 30px;
font-size: 16px;
font-weight: bold;
color: #c3002f;
}
#custInfos {
position: absolute;
top: 42px;
left: 30px;
line-height: 0px;
}
#vehicleTitle {
position: absolute;
top: 115px;
left: 30px;
line-height: 0px;
font-size: 16px;
font-weight: bold;
color: #c3002f;
}
#vehicleInfos {
position: absolute;
top: 140px;
left: 30px;
}
#vehicleDescription {
position: absolute;
right: 5%;
top: 42px;
width: 50vw;
text-align: center;
}
#custInfos > span {
position: relative;
color: #343434;
font-size: 14px;
text-align: left;
}
#custInfos > div {
line-height: 35px;
}
#custInfos > span:nth-of-type(odd) {
font-weight: normal;
}
#custInfos > span:nth-of-type(even) {
font-weight: bold;
}
#carImg {
position: relative;
top: 85px;
right: 6%;
display: block;
margin: 0 auto;
float: right;
width: 47%;
border-radius: 15px;
}
.containerFuel {
width: 40%;
display: inline-block;
position: relative;
}
.imageFuel {
width: 40%;
margin-top: 18px;
margin-bottom: 18px;
border-radius: 15px;
}
.iconFuelOrMileage {
width: 49px;
}
</style>
<style>
#healthCheck {
position: relative;
display: block;
width: 100%;
height: 100%;
}
#topBar {
height: 100 px;
width: 100%;
background: #f4f4f4 !important;
box-shadow: 0 4px 2px -2px #e1e1e1;
margin-bottom: 4px;
text-align: left;
padding-bottom: 10 px;
}
/*#topBar > div {
/*position: relative;
/*display: inline-block;
}*/
/*#topBar > div: nth-of-type(1) {
margin-top: 25 px;
margin-left: 30 px;
margin-bottom: 15 px;
}*/
/*
#topBar > .green {
}
#topBar > div:nth-of-type(n+2) {
margin-bottom: 9px;
vertical-align: middle;
}
#topBar > div:nth-of-type(n+4):nth-of-type(even) {
margin-left: 22px;
}
#topBar > div:nth-of-type(n+3):nth-of-type(odd) {
font-size: 12px;
font-weight: bold;
color: #343434;
}
#topBar > div:nth-of-type(1) > span:nth-of-type(1) {
font-size: 17px;
font-weight: bold;
color: #c3002f;
}*/
.CategoryTitle, .CategoryContent {
}
.CategoryTitle > div, .CategoryContent > div {
margin-left: 30px;
position: relative;
}
.CategoryTitle {
height: 45px;
width: 100%;
}
/* From all div into .CategoryTitle keep the first one */
.CategoryTitle > div:nth-of-type(1) {
display: inline-block;
top: 15px;
vertical-align: middle;
font-size: 14px;
font-weight: bold;
color: #343434;
}
.CategoryContent {
height: 25px;
width: 100%;
}
.CategoryContent > .green, .CategoryContent > .yellow, .CategoryContent > .red {
float: right;
margin-right: 30px;
margin-top: 6px;
}
/* From all div into .CategoryContent keep the first one */
.CategoryContent > div:nth-of-type(1) {
display: inline-block;
font-size: 12px;
font-weight: normal;
color: #343434;
}
#healthCheckBot {
margin-bottom: 62px;
text-align: center;
}
#fakeContent {
height: 150px;
}
</style>
<style>
#bodyPaint {
position: relative;
display: block;
width: 100%;
height: 100%;
}
#BodyTitle > span {
position: relative;
display: block;
margin-left: 30px;
}
#BodyTitle > span:nth-of-type(1) {
font-size: 17px;
font-weight: bold;
color: #c3002f;
}
#BodyTitle > span:nth-of-type(2) {
margin-top: 22px;
font-size: 17px;
font-weight: normal;
color: #343434;
}
.BodyPaintPictureContainer {
position: relative;
display: block;
width: 100%;
height: 415px;
margin: 0 auto;
border: 1px solid black;
background-color: #343434;
}
.BodyPaintPicture {
max-height: 100%;
max-width: 100%;
width: auto;
height: auto;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
#bodyPaintBot {
margin-bottom: 50px;
}
</style>
<style>
#signatures {
position: relative;
display: block;
width: 100%;
height: 450px;
}
#signaturesTitles {
position: absolute;
top: 50px;
}
#signatureOne, #signatureTwo {
position: relative;
display: inline-block;
}
#signatureOne {
margin-left: 30px;
}
#signatureTwo {
margin-left: 21px;
}
#signatureOne > div:nth-of-type(1), #signatureTwo > div:nth-of-type(1) {
font-size: 17px;
font-weight: bold;
color: #c3002f;
margin-bottom: 40px;
}
.signatureBlock {
width: 340px;
height: 300px;
background: #ffffff !important;
box-shadow: 0 0 2px 1px #8a8a8a inset;
}
</style>
<style>
/* new balises */
.containerBodyDamageElement {
margin-top: 40px;
width: 45%;
display: inline-block;
text-align: center;
}
.containerPictureDamage {
display: inline-block;
width: 45%;
}
.pictureDamage {
display: inline-block;
width: 50px;
}
.imgDamage {
width: 100px;
}
.containerContentDamage {
}
.containerSidePictureAndType {
display: -webkit-box;
top: 120px;
position: absolute;
}
.iconSideDamage {
width: 50px;
margin-left: 140px;
}
.typeDamage {
}
.commentDamage {
width: 150px;
height: 150px;
}
#annexe {
position: relative;
display: block;
width: 100%;
height: 100%;
}
#annexeTitle {
position: relative;
display: block;
padding-top: 50px;
margin-left: 30px;
font-size: 17px;
font-weight: bold;
color: #c3002f;
}
.annexePortrait {
}
.annexePicPortrait {
vertical-align: middle;
position: relative;
display: inline-block;
margin-left: 30px;
width: 200px;
height: 268px;
}
.annexeImg {
max-height: 100%;
max-width: 100%;
width: auto;
height: auto;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
.picto {
position: relative;
display: inline-block;
vertical-align: top;
height: 180px;
width: 85px;
}
.pictoNum {
position: absolute;
display: inline-block;
margin-left: 25px;
width: 45px;
height: 45px;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
background: #c3002f !important;
}
.numInside {
position: relative;
display: block;
top: 13px;
text-align: center;
font-size: 15px;
font-weight: bold;
color: #ffffff;
}
.pictoDmg {
position: absolute;
right: 0;
width: 70px;
height: 70px;
}
.imgDmg {
height: 80%;
width: 80%;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
.comment {
margin-top: 30px;
}
.dmgComment {
margin-top: 15px;
font-size: 10px;
}
.comment > .dmgType > div:nth-of-type(1) {
display: inline-block;
font-size: 12px;
font-weight: bold;
color: #343434;
}
.comment > .dmgType > div:nth-of-type(2) {
display: inline-block;
font-size: 10px;
font-weight: normal;
color: #343434;
}
#disclaimer {
font-size: 10px;
color: #343434;
}
</style>
My Html code :
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<div>
<div id="header">
<div>
<div id="custDetail">
<div id="custTitle">
<span>#CUSTOMER_DETAILS#</span>
</div>
<div id="custInfos">
<span>#NAME_LABEL# : </span>
<span>#NAME#</span>
<div> <br> </div>
<span>#PHONE_LABEL# : </span>
<span>#PHONE#</span>
</div>
<div id="vehicleDescription">
<span><b>J11 Qashqai Tekna 5DR Wagon 1.6L Turbo Diesel 4WD 4 Cyl 6sp Manual</b></span>
</div>
<div id="vehicleTitle">
<span>#VEHICLE_DETAILS#</span>
</div>
<div id="vehicleInfos">
<span>#VIN_LABEL# : </span>
<span><b>#VIN#</b></span>
<div> <br> </div>
<span>#MODEL_LABEL# : </span>
<span><b>#MODEL#</b></span>
<div> <br> </div>
<span>#REG_NUM_LABEL# : </span>
<span><b>#REG_NUM#</b></span>
<div> <br> </div>
<span>#KILOMETER_LABEL# : </span>
<span><b>#KILOMETER#</b></span>
<div> <br> </div>
<span>#CARBURANT_LABEL# : </span>
<span><b>#CARBURANT#</b></span>
<div> <br> </div>
</div>
<div>
</div>
</div>
</div>
<div id="containerImageFuelAndMileage">
<div class="containerFuel">
<div class="">
<div class="fuelDescription">
<div> #MILEAGE# : <b>#MILEAGE_VALUE#</b></div>
</div>
</div>
<div class="containerPictoFuel">
<div class="pictoFuel">
<img class="iconFuelOrMileage" alt="imgDmg" src="https://cdn4.iconfinder.com/data/icons/adiante-apps-app-templates-incos-in-grey/512/app_type_gas_stations_512px_GREY.png">
</div>
</div>
<div class="containerFuelDescription">
</div>
</div>
<div class="containerFuel">
<div class="">
<div class="fuelDescription">
<div> #FUEL# : <b>#FUEL_VALUE# </b></div>
</div>
</div>
<div class="containerPictoFuel">
<div class="pictoFuel">
<img class="iconFuelOrMileage" name="" alt="imgDmg" src="https://cdn4.iconfinder.com/data/icons/adiante-apps-app-templates-incos-in-grey/512/app_type_gas_stations_512px_GREY.png">
</div>
</div>
<div class="containerFuelDescription">
</div>
</div>
</div>
<div id="healthCheckBot">
<p> Page 1 </p>
</div>
<div class="footer"></div>
<div>
<div id="healthCheck">
<div id="topBar">
<div>
#Test#
</div>
</div>
</div>
</div>
</body>
</html>
Quick question, I need help and have no idea what to do, because I know nothing about html/css and got this as a bonus task along with other programming things.
What I have:
What I would like to have:
Here is css code
.offer-small { width: 278px; height: 209px; position: relative; margin-bottom: 25px; }
.offer-small img { width: 278px; height: 209px; }
.offer-small .mask { width: 278px; height: 209px; cursor: pointer; position: absolute; top: 0; left: 0; background: url('../images/photo-small-mask.png'); }
.offer-small .desc { display: none; font-size: 10pt; width: 258px; height: 189px; padding: 10px; position: absolute; top: 0; left: 0; background: url('../images/photo-small-black-transparent.png'); color: white; text-shadow: 1px 1px #000000}
.offer-small .desc p { font-size: 9pt; color: #f2f0e4; }
.offer-small .desc table.compare { width: 160px; height: 48px; margin: 0 auto 0 auto; background: url('../images/offer-table.png'); color: #f2f0e4; }
.offer-small .desc table td { text-align: center; padding-bottom: 10px; }
.offer-small .desc table td.small { font-size: 8pt; }
.offer-small .title { width: 258px; background: url('../images/offer-transparent.png'); padding: 2px 10px; position: absolute; top: 120px; left: 0; }
.offer-small .title strong { font-size: 9pt; color: #ffffff; }
.offer-small .title small { font-size: 8pt; color: #f2f0e4; }
.offer-small .title small strong { font-size: 8pt; color: #f2f0e4; }
.offer-small .view-offer { position: absolute; top: 160px; left: 150px; }
.view-offer { display: block; width: 120px; height: 44px; background: url('../images/button-view-offer.png'); }
.btnSendOrder { width: 260px; height: 75px; border: 0; background: url('../images/button-send-order.png'); cursor: pointer; }
.toLeft { float: left; margin-right: 25px; }
Html/smarty code:
{if $random}{foreach item=item from=$random}
<div class="offer-small">
<img src="{$smarty.const.APP_URL}/userfiles/photos/{if $item.item_photo}s_{$item.item_photo}{else}blank_small.jpg{/if}" alt="" />
<div class="desc">
<strong>{$item.item_name|truncate:30}</strong>
<p>{$item.item_short_description|truncate:120}</p>
<p align="right"></p>
</div>
<div class="title">
<strong>{$item.item_name|truncate:30}</strong><br/><small>Cena teraz: <strong>{$item.item_cost_now|money} zł</strong> zamiast <strong>{$item.item_cost_before|money} zł</strong></small><br/><br/>
<strong>OSZCZĘDZASZ <big>{$item.item_cost_before-$item.item_cost_now|money}</big> zł</strong>
</div>
</div>
{/foreach}{/if}
Tips are welcome too.
I mean I can handle making grid if someone will show me how to break this stupid list.
An easy way is to just float the divs of class .offer-small left:
.offer-small {
width: 278px;
height: 209px;
position: relative;
margin-bottom: 25px;
float:left;
}
As long as you have them all within a container element with a fixed width, they should fit next to each other nicely, wrapping to the next line automatically.