I'm just wonderfin if anyone can tell me if I am on the right track to styling this properly?
with my CSS and HTML like this
#bulletsBox{
position: relative;
height: 382px;
width: 736px;
padding-top: 40px;
padding-bottom: 48px;
padding-right: 102px;
padding-left: 102px;
}
dl#Bullets,#Bullets2, #Bullets3, #Bullets4, #Bullets5, #Bullets6{
position: relative;
height: 210px;
width: 210px;
display: inline;
margin-right: 50px;
list-style-type: none;
}
#Bullets dt,#Bullets2 dt,#Bullets3 dt, #Bullets4 dt,#Bullets5 dt,#Bullets6 dt{
font-family: Arial, Helvetica, sans-serif;
list-style-type: none;
font-size: 14px;
color: #969b94;
text-transform: uppercase;
padding-bottom: 12px;
}
#Bullets dd,#Bullets2 dd ,#Bullets3 dd, #Bullets4 dd,#Bullets5 dd,#Bullets6 dd{
font-family: Arial, Helvetica, sans-serif;
list-style-type: none;
font-size: 12px;
color: #686869;
margin: 0px;
line-height: 18px;
}
<div id="bulletsBox">
<dl id="Bullets">
<dt>web standards</dt>
<dd>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam interdum malesuada velit, sed fringilla nulla posuere at. Donec dapibus cursus rutrum. Praesent ultrices facilisis vehicula. Praesent vitae urna non magna dictum porttitor. Mauris ut ligula enim.</dd>
</dl>
<dl id="Bullets2">
<dt>web standards</dt>
<dd>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam interdum malesuada velit, sed fringilla nulla posuere at. Donec dapibus cursus rutrum. Praesent ultrices facilisis vehicula. Praesent vitae urna non magna dictum porttitor. Mauris ut ligula enim.</dd>
</dl>
<dl id="Bullets3" style="margin:0px">
<dt>web standards</dt>
<dd>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam interdum malesuada velit, sed fringilla nulla posuere at. Donec dapibus cursus rutrum. Praesent ultrices facilisis vehicula. Praesent vitae urna non magna dictum porttitor. Mauris ut ligula enim.</dd>
</dl>
<dl id="Bullets4">
<dt>web standards</dt>
<dd>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam interdum malesuada velit, sed fringilla nulla posuere at. Donec dapibus cursus rutrum. Praesent ultrices facilisis vehicula. Praesent vitae urna non magna dictum porttitor. Mauris ut ligula enim.</dd>
</dl>
<dl id="Bullets5">
<dt>web standards</dt>
<dd>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam interdum malesuada velit, sed fringilla nulla posuere at. Donec dapibus cursus rutrum. Praesent ultrices facilisis vehicula. Praesent vitae urna non magna dictum porttitor. Mauris ut ligula enim.</dd>
</dl>
<dl id="Bullets6" style="margin:0px">
<dt>web standards</dt>
<dd>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam interdum malesuada velit, sed fringilla nulla posuere at. Donec dapibus cursus rutrum. Praesent ultrices facilisis vehicula. Praesent vitae urna non magna dictum porttitor. Mauris ut ligula enim.</dd>
</dl>
</div><!--end of bulletsBox-->
it displays how I want it to in Dreamweaver like this
but when I veiw it in a browser it looks like this
You can get rid of the display:inline on #Bullets dt,#Bullets2 dt,#Bullets3 dt, #Bullets4 dt,#Bullets5 dt,#Bullets6 dt and just put float:left instead.
You'll also want to correct the inline style of margin:0px on #Bullets3 and #Bullets6 and replace it with margin-right:0px since I think that's really the only margin value you want to override.
Finally, just use #bulletsBox dl to refer to all the #Bullets elements inside of it. Easier to read and write :)
You need to add float:left; to your rule dl#Bullets, #Bullets2, #Bullets3, #Bullets4, #Bullets5, #Bullets6 {...
Here's a jsFiddle example.
You're working too hard. Let CSS inheritance do the work. All these extra class names are not required.
Note: you do not need to use position:relative unless you plan to use absolute positioning on a child element.
<div id="bulletsBox">
<dl>
<dt>web standards</dt>
<dd>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam interdum malesuada velit, sed fringilla nulla posuere at. Donec dapibus cursus rutrum. Praesent ultrices facilisis vehicula. Praesent vitae urna non magna dictum porttitor. Mauris ut ligula enim.</dd>
</dl>
<dl>
<dt>web standards</dt>
<dd>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam interdum malesuada velit, sed fringilla nulla posuere at. Donec dapibus cursus rutrum. Praesent ultrices facilisis vehicula. Praesent vitae urna non magna dictum porttitor. Mauris ut ligula enim.</dd>
</dl>
<dl>
<dt>web standards</dt>
<dd>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam interdum malesuada velit, sed fringilla nulla posuere at. Donec dapibus cursus rutrum. Praesent ultrices facilisis vehicula. Praesent vitae urna non magna dictum porttitor. Mauris ut ligula enim.</dd>
</dl>
<dl>
<dt>web standards</dt>
<dd>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam interdum malesuada velit, sed fringilla nulla posuere at. Donec dapibus cursus rutrum. Praesent ultrices facilisis vehicula. Praesent vitae urna non magna dictum porttitor. Mauris ut ligula enim.</dd>
</dl>
<dl>
<dt>web standards</dt>
<dd>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam interdum malesuada velit, sed fringilla nulla posuere at. Donec dapibus cursus rutrum. Praesent ultrices facilisis vehicula. Praesent vitae urna non magna dictum porttitor. Mauris ut ligula enim.</dd>
</dl>
<dl>
<dt>web standards</dt>
<dd>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam interdum malesuada velit, sed fringilla nulla posuere at. Donec dapibus cursus rutrum. Praesent ultrices facilisis vehicula. Praesent vitae urna non magna dictum porttitor. Mauris ut ligula enim.</dd>
</dl>
</div>
CSS:
#bulletsBox {
height: 382px;
width: 736px;
padding-top: 40px;
padding-bottom: 48px;
padding-right: 102px;
padding-left: 102px;
}
#bulletsBox dl {
height: 210px;
width: 210px;
float:left; <--- added this
margin-right: 50px;
list-style-type: none;
}
#bulletsBox dt {
font-family: Arial, Helvetica, sans-serif;
list-style-type: none;
font-size: 14px;
color: #969b94;
text-transform: uppercase;
padding-bottom: 12px;
}
#bulletsBox dd {
font-family: Arial, Helvetica, sans-serif;
list-style-type: none;
font-size: 12px;
color: #686869;
margin: 0px;
line-height: 18px;
}
Related
I need some help.
There are a few containers that have text inside. Obviously there is a lot of text, so there have to be scroll. But I don't want text look like it's cut, I want to "blur" the bottom of the single container.
Here are the results: https://jsfiddle.net/rsze93wk/3/
Well, it looks... pretty shitty in my opinion. The bottom of the container should be almost invisible, but I can clearly read it. I used :after and display: block to make this effect, so I'm unable to select the text under that pseudo-element.
There is also a problem, gradient stays in one place when I scroll down. Can you help me solve this? Also, maybe you have any ideas how to make this effect look much better?
Update: the first snippet seems to be buggy on Chrome but works fine on Firefox
You can try to color the text using gradient like below:
body {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
margin: 0;
height: 100vh;
}
.container {
padding: 20px;
border: 1px solid black;
}
.main:not(:first-child) {
margin-top: 20px;
}
.main {
width: 200px;
height: 200px;
box-shadow: 0px 0px 20px 1px rgba(0,0,0,0.75);
overflow: auto;
text-align: center;
background: linear-gradient(#000 calc(100% - 50px),white);
-webkit-background-clip:text;
background-clip:text;
color:transparent;
}
<div class="container">
<div class="main">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ex massa, vestibulum non quam quis, commodo fermentum purus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce in erat libero. Phasellus ipsum odio, rutrum porttitor velit a, venenatis cursus nisi. Donec venenatis, felis at luctus ullamcorper, leo nibh scelerisque orci, et pellentesque quam libero vel enim. Pellentesque a mauris nibh. Suspendisse eu laoreet nisi. Pellentesque bibendum ullamcorper iaculis. Nulla tortor odio, vehicula ac diam non, aliquet tristique sem.</p>
</div>
<div class="main">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ex massa, vestibulum non quam quis, commodo fermentum purus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce in erat libero. Phasellus ipsum odio, rutrum porttitor velit a, venenatis cursus nisi. Donec venenatis, felis at luctus ullamcorper, leo nibh scelerisque orci, et pellentesque quam libero vel enim. Pellentesque a mauris nibh. Suspendisse eu laoreet nisi. Pellentesque bibendum ullamcorper iaculis. Nulla tortor odio, vehicula ac diam non, aliquet tristique sem.</p>
</div>
</div>
Another alternative using sticky:
body {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
margin: 0;
height: 100vh;
}
.container {
padding: 20px;
border: 1px solid black;
}
.main:not(:first-child) {
margin-top: 20px;
}
.main {
width: 200px;
height: 200px;
box-shadow: 0px 0px 20px 1px rgba(0,0,0,0.75);
overflow: auto;
text-align: center;
}
.main::after {
content:"";
display:block;
height:200px;
margin-top:-200px;
position:sticky;
bottom:0;
background: linear-gradient(transparent calc(100% - 50px),white);
pointer-events:none;
}
<div class="container">
<div class="main">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ex massa, vestibulum non quam quis, commodo fermentum purus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce in erat libero. Phasellus ipsum odio, rutrum porttitor velit a, venenatis cursus nisi. Donec venenatis, felis at luctus ullamcorper, leo nibh scelerisque orci, et pellentesque quam libero vel enim. Pellentesque a mauris nibh. Suspendisse eu laoreet nisi. Pellentesque bibendum ullamcorper iaculis. Nulla tortor odio, vehicula ac diam non, aliquet tristique sem.</p>
</div>
<div class="main">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ex massa, vestibulum non quam quis, commodo fermentum purus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce in erat libero. Phasellus ipsum odio, rutrum porttitor velit a, venenatis cursus nisi. Donec venenatis, felis at luctus ullamcorper, leo nibh scelerisque orci, et pellentesque quam libero vel enim. Pellentesque a mauris nibh. Suspendisse eu laoreet nisi. Pellentesque bibendum ullamcorper iaculis. Nulla tortor odio, vehicula ac diam non, aliquet tristique sem.</p>
</div>
</div>
And if you want a real blur effect use backdrop-filter:
body {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
margin: 0;
height: 100vh;
}
.container {
padding: 20px;
border: 1px solid black;
}
.main:not(:first-child) {
margin-top: 20px;
}
.main {
width: 200px;
height: 200px;
box-shadow: 0px 0px 20px 1px rgba(0,0,0,0.75);
overflow: auto;
text-align: center;
}
.main::after {
content:"";
display:block;
height:20px;
margin-top:20px;
position:sticky;
bottom:0;
pointer-events:none;
-webkit-backdrop-filter:blur(5px);
backdrop-filter:blur(5px);
}
<div class="container">
<div class="main">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ex massa, vestibulum non quam quis, commodo fermentum purus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce in erat libero. Phasellus ipsum odio, rutrum porttitor velit a, venenatis cursus nisi. Donec venenatis, felis at luctus ullamcorper, leo nibh scelerisque orci, et pellentesque quam libero vel enim. Pellentesque a mauris nibh. Suspendisse eu laoreet nisi. Pellentesque bibendum ullamcorper iaculis. Nulla tortor odio, vehicula ac diam non, aliquet tristique sem.</p>
</div>
<div class="main">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ex massa, vestibulum non quam quis, commodo fermentum purus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce in erat libero. Phasellus ipsum odio, rutrum porttitor velit a, venenatis cursus nisi. Donec venenatis, felis at luctus ullamcorper, leo nibh scelerisque orci, et pellentesque quam libero vel enim. Pellentesque a mauris nibh. Suspendisse eu laoreet nisi. Pellentesque bibendum ullamcorper iaculis. Nulla tortor odio, vehicula ac diam non, aliquet tristique sem.</p>
</div>
</div>
I want to "blur" the bottom of the single container.
Blur is CSS filter (filter: blur(1)) and you can't use it here with the after:: pseudoelement because content of that element is empty.
I used :after and display: block to make this effect, so I'm unable to select the text under that pseudo-element.
This is a good and common solution. To make text bellow the after:: clickable you can add pointer-events: none; to the after::.
There is also a problem, gradient stays in one place when I scroll down.
after:: should be positioned to the .main and in the .main you should have another container with scroll.
Currently stuck on how to align the textbox and button on the same line with 50% width (in footer), can anyone give me some sort or guide or able to fix this issue for me?
[Extra questions, any further support or guidance would be appreciated, Wireframe given for basic idea]
One being how to put spacing between the text and picture that are aligned below the navbar.
Below that, how to put a thin border for each separate picture and box of text.
(Sorry if i'm not allowed to ask extra questions)
You could use css flexbox to achieve the
"align the textbox and button on the same line with 50% width"
part Specifically, add
form .container {
display: flex;
align-items: center;
justify-content: space-between;
}
to your css file. I included the modified project below so that you could check the effect. More about CSS flexbox at here.
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover {
background-color: #111;
}
.paragraph {
padding: 5px;
}
.row {
display: flex;
}
/* Create three equal columns that sits next to each other */
.column {
flex: 33.33%;
padding: 5px;
}
.footer {
position: relative;
right: 0;
bottom: 0;
left: 0;
padding: 1rem;
text-align: center;
}
form .container {
display: flex;
align-items: center;
justify-content: space-between;
}
input[type=text] {
width: 50%;
padding: 15px;
margin: 5px 0 5px 0;
display: inline-block;
border: none;
background: #f1f1f1;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="main.css">
<title>Chollerton Tearooms</title>
</head>
<body>
<ul>
<li><a class="" href="index.html">Home</a></li>
<li>Find out more</li>
<li>Credits</li>
<li>Wireframe</li>
<li>Admin</li>
</ul>
<div class="main-column">
<div class="paragraph">
<img src="Tearoom.png" alt="Holiday" width="400" height="200" align="left">
<h1> Tearoom</h1>
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque, quam finibus eleifend venenatis, augue velit finibus orci, a pretium nisi dolor vitae elit. Nam dignissim urna a turpis cursus malesuada. Vestibulum bibendum quis dui scelerisque laoreet. Aliquam tempus, leo ornare finibus elementum, est felis venenatis arcu, eu ultricies ipsum neque id tellus. Praesent ut ipsum malesuada, blandit nulla vitae, blandit orci. Aliquam erat volutpat. Sed porta consectetur tempus. Vestibulum ac tincidunt ipsum. Suspendisse volutpat non magna id placerat. Nullam et mi eu lacus lacinia sodales. Sed non interdum ante. Nam eu posuere ipsum. Nullam pulvinar ipsum euismod tellus vulputate ullamcorper. Maecenas ac quam vulputate, venenatis mi eget, dictum erat.
</p>
</div>
</div>
<br><br><br><br>
<div class="row">
<div class="column">
<img src="Craftshop.png" alt="Craft" style="width:100%">
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque, quam finibus eleifend venenatis, augue velit finibus orci, a pretium nisi dolor vitae elit. Nam dignissim urna a turpis cursus malesuada. Vestibulum bibendum quis dui scelerisque laoreet. Aliquam tempus, leo ornare finibus elementum, est felis venenatis arcu, eu ultricies ipsum neque id tellus. Praesent ut ipsum malesuada, blandit nulla vitae, blandit orci. Aliquam erat volutpat. Sed porta consectetur tempus. Vestibulum ac tincidunt ipsum. Suspendisse volutpat non magna id placerat. Nullam et mi eu lacus lacinia sodales. Sed non interdum ante. Nam eu posuere ipsum. Nullam pulvinar ipsum euismod tellus vulputate ullamcorper. Maecenas ac quam vulputate, venenatis mi eget, dictum erat.
</div>
<div class="column">
<img src="General%20Store.jpg" alt="Store" style="width:100%">
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque, quam finibus eleifend venenatis, augue velit finibus orci, a pretium nisi dolor vitae elit. Nam dignissim urna a turpis cursus malesuada. Vestibulum bibendum quis dui scelerisque laoreet. Aliquam tempus, leo ornare finibus elementum, est felis venenatis arcu, eu ultricies ipsum neque id tellus. Praesent ut ipsum malesuada, blandit nulla vitae, blandit orci. Aliquam erat volutpat. Sed porta consectetur tempus. Vestibulum ac tincidunt ipsum. Suspendisse volutpat non magna id placerat. Nullam et mi eu lacus lacinia sodales. Sed non interdum ante. Nam eu posuere ipsum. Nullam pulvinar ipsum euismod tellus vulputate ullamcorper. Maecenas ac quam vulputate, venenatis mi eget, dictum erat.
</div>
<div class="column">
<img src="B&B.jpg" alt="Bed and breakfast" style="width:100%">
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque, quam finibus eleifend venenatis, augue velit finibus orci, a pretium nisi dolor vitae elit. Nam dignissim urna a turpis cursus malesuada. Vestibulum bibendum quis dui scelerisque laoreet. Aliquam tempus, leo ornare finibus elementum, est felis venenatis arcu, eu ultricies ipsum neque id tellus. Praesent ut ipsum malesuada, blandit nulla vitae, blandit orci. Aliquam erat volutpat. Sed porta consectetur tempus. Vestibulum ac tincidunt ipsum. Suspendisse volutpat non magna id placerat. Nullam et mi eu lacus lacinia sodales. Sed non interdum ante. Nam eu posuere ipsum. Nullam pulvinar ipsum euismod tellus vulputate ullamcorper. Maecenas ac quam vulputate, venenatis mi eget, dictum erat.
</div>
</div>
<div class="footer"> what i did to ensure that the footer stayed in the correct position was actually setting the position to be absolute, this will stop it from overlapping.</div>
<form action="/action_page.php" style="border:1px solid #ccc">
<div class="container">
<input type="text" placeholder="Enter Email" name="email" required>
<div class="clearfix">
<button type="submit" class="signupbtn">Subscribe </button>
</div>
</div>
</form>
</body>
</html>
As of adding space between image and text, you could simply apply a margin or some padding to the image. Something like this will do:
.desired-img {
margin: 5px;
}
To add border to a paragraph, simply use css to style your border. Something like this will do the job:
.column {
border: 1px solid lightgrey;
}
Hope this helps!
You need to remove the button from it's own div block element and put inline with the input. I've set the .container div to 50% and centered aligned the input and button. To add space between your image and text, just and a margin to the right and bottom. And you can simple add a border attribute to your .column class to give a thin border:
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover {
background-color: #111;
}
#holidayImg {
margin: 0px 20px 20px 0px;
}
.paragraph {
padding: 5px;
}
{
box-sizing: border-box;
}
.row {
display: flex;
}
/* Create three equal columns that sits next to each other */
.column {
flex: 33.33%;
padding: 5px;
border: solid 1px #ccc;
margin: 0px 5px;
border-radius 4px;
}
.footer {
position: relative;
right: 0;
bottom: 0;
left: 0;
padding: 1rem;
text-align: center;
}
.container {
display: flex;
}
input[type=text] {
padding: 15px;
margin: 5px;
display: inline-block;
border: none;
background: #f1f1f1;
width: 50%;
}
.signupbtn {
width: 50%;
margin: 5px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="main.css">
<title>Chollerton Tearooms</title>
</head>
<body>
<ul>
<li><a class="" href="index.html">Home</a></li>
<li>Find out more</li>
<li>Credits</li>
<li>Wireframe</li>
<li>Admin</li>
</ul>
<div class="main-column">
<div class="paragraph">
<img src="Tearoom.png" alt="Holiday" width="400" height="200" align="left" id="holidayImg">
<h1> Tearoom</h1>
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque, quam finibus eleifend venenatis, augue velit finibus orci, a pretium nisi dolor vitae elit. Nam dignissim urna a turpis cursus malesuada. Vestibulum bibendum quis dui scelerisque
laoreet. Aliquam tempus, leo ornare finibus elementum, est felis venenatis arcu, eu ultricies ipsum neque id tellus. Praesent ut ipsum malesuada, blandit nulla vitae, blandit orci. Aliquam erat volutpat. Sed porta consectetur tempus. Vestibulum
ac tincidunt ipsum. Suspendisse volutpat non magna id placerat. Nullam et mi eu lacus lacinia sodales. Sed non interdum ante. Nam eu posuere ipsum. Nullam pulvinar ipsum euismod tellus vulputate ullamcorper. Maecenas ac quam vulputate, venenatis
mi eget, dictum erat.
</p>
</div>
</div>
<br><br><br><br>
<div class="row">
<div class="column">
<img src="Craftshop.png" alt="Craft" style="width:100%">
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque, quam finibus eleifend venenatis, augue velit finibus orci, a pretium nisi dolor vitae elit. Nam dignissim urna a turpis cursus malesuada. Vestibulum bibendum quis dui scelerisque
laoreet. Aliquam tempus, leo ornare finibus elementum, est felis venenatis arcu, eu ultricies ipsum neque id tellus. Praesent ut ipsum malesuada, blandit nulla vitae, blandit orci. Aliquam erat volutpat. Sed porta consectetur tempus. Vestibulum
ac tincidunt ipsum. Suspendisse volutpat non magna id placerat. Nullam et mi eu lacus lacinia sodales. Sed non interdum ante. Nam eu posuere ipsum. Nullam pulvinar ipsum euismod tellus vulputate ullamcorper. Maecenas ac quam vulputate, venenatis
mi eget, dictum erat.
</div>
<div class="column">
<img src="General%20Store.jpg" alt="Store" style="width:100%">
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque, quam finibus eleifend venenatis, augue velit finibus orci, a pretium nisi dolor vitae elit. Nam dignissim urna a turpis cursus malesuada. Vestibulum bibendum quis dui scelerisque
laoreet. Aliquam tempus, leo ornare finibus elementum, est felis venenatis arcu, eu ultricies ipsum neque id tellus. Praesent ut ipsum malesuada, blandit nulla vitae, blandit orci. Aliquam erat volutpat. Sed porta consectetur tempus. Vestibulum
ac tincidunt ipsum. Suspendisse volutpat non magna id placerat. Nullam et mi eu lacus lacinia sodales. Sed non interdum ante. Nam eu posuere ipsum. Nullam pulvinar ipsum euismod tellus vulputate ullamcorper. Maecenas ac quam vulputate, venenatis
mi eget, dictum erat.
</div>
<div class="column">
<img src="B&B.jpg" alt="Bed and breakfast" style="width:100%">
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque, quam finibus eleifend venenatis, augue velit finibus orci, a pretium nisi dolor vitae elit. Nam dignissim urna a turpis cursus malesuada. Vestibulum bibendum quis dui scelerisque
laoreet. Aliquam tempus, leo ornare finibus elementum, est felis venenatis arcu, eu ultricies ipsum neque id tellus. Praesent ut ipsum malesuada, blandit nulla vitae, blandit orci. Aliquam erat volutpat. Sed porta consectetur tempus. Vestibulum
ac tincidunt ipsum. Suspendisse volutpat non magna id placerat. Nullam et mi eu lacus lacinia sodales. Sed non interdum ante. Nam eu posuere ipsum. Nullam pulvinar ipsum euismod tellus vulputate ullamcorper. Maecenas ac quam vulputate, venenatis
mi eget, dictum erat.
</div>
</div>
<div class="footer"> what i did to ensure that the footer stayed in the correct position was actually setting the position to be absolute, this will stop it from overlapping.</div>
<form action="/action_page.php" style="border:1px solid #ccc">
<div class="container">
<input type="text" placeholder="Enter Email" name="email" required>
<button type="submit" class="signupbtn">Subscribe </button>
</div>
</form>
</body>
</html>
If I understand what you're asking, you can add another class as follows:
<div class="container">
<input type="text" placeholder="Enter Email" name="email" required class="side-by-side">
<div class="clearfix side-by-side">
<button type="submit" class="signupbtn">Subscribe </button>
</div>
</div>
// CSS added to get effect
.container {
width: 100%;
float: right;
}
.side-by-side {
display: inline;
}
This way it stays on 1 line and stays on the right side similar to your wireframe.
There is a line gap between first line to second line. How to remove it?
ol {
color: #fff;
list-style-type: decimal;
background: #152a40;
width: 100%;
margin: 50px auto;
padding: 1.2em 30px 1.2em 75px;
line-height: 0;
}
ol li {
position: relative;
font: bold italic 45px/1.5 Helvetica, Verdana, sans-serif;
margin-bottom: 2px;
}
li p {
font: 15px/1.5 Helvetica, sans-serif;
padding-left: 60px;
color: #eaeaea;
}
<ol>
<li>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent euismod ultrices ante, ac laoreet nulla vestibulum adipiscing. Nam quis justo in augue auctor imperdiet. Curabitur aliquet orci sit amet est posuere consectetur. Fusce nec leo ut massa
viverra venenatis. Nam accumsan libero a elit aliquet quis ullamcorper arcu tincidunt. Praesent purus turpis, consectetur quis congue vel, pulvinar at lorem. Vivamus varius condimentum dolor, quis ultricies ipsum porta quis. </p>
</li>
<li>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent euismod ultrices ante, ac laoreet nulla vestibulum adipiscing. Nam quis justo in augue auctor imperdiet. Curabitur aliquet orci sit amet est posuere consectetur. </p>
</li>
<li>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent euismod ultrices ante, ac laoreet nulla vestibulum adipiscing. Nam quis justo in augue auctor imperdiet. Curabitur aliquet orci sit amet est posuere consectetur. </p>
</li>
</ol>
The issue originates from the fact that the list item's counter is actually part of the DOM node: therefore, increasing it's font size and therefore its line-height will actually influence how the first line looks like.
For a fool-proof setup, you will want to isolate the counter from the actual <li> content. In order to do this, we can use CSS counters.
Declare a custom counter (let's name it listCounter) on the parent element (<ol> in this case), so that it is reset for each occurrence, e.g. counter-reset: listCounter.
Increment the counter in the nested <li> elements, using: counter-increment: listCounter;. Also, since we are using custom counters, disable the default counter using list-style: none.
Use ::before pseudo-element on the <li> element to display our custom counter, using content: counter(listCounter).
Here is a proof-of-concept example:
ol {
color: #fff;
list-style-type: decimal;
background: #152a40;
width: 100%;
margin: 50px auto;
padding: 1.2em 30px 1.2em 75px;
line-height: 0;
/* Reset counter */
counter-reset: listCounter;
}
ol li {
position: relative;
margin-bottom: 2px;
/* Increment counter by 1 in each <li> */
counter-increment: listCounter;
/* Hide default bullets/list counter */
list-style: none;
/*
* Top padding to accommodate tall list counter
* This value is a trial and error value, used to align baselines of counter and paragraph's first line
*/
padding-top: 18px;
}
ol li::before {
/* Set pseudo-element's content as counter */
content: counter(listCounter) ".";
font: bold italic 45px/1.5 Helvetica, Verdana, sans-serif;
/* Positioning, you decide how you want it to look */
position: absolute;
left: -10px;
top: 0;
}
li p {
font: 15px/1.5 Helvetica, sans-serif;
padding-left: 60px;
color: #eaeaea;
}
<ol>
<li>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent euismod ultrices ante, ac laoreet nulla vestibulum adipiscing. Nam quis justo in augue auctor imperdiet. Curabitur aliquet orci sit amet est posuere consectetur. Fusce nec leo ut massa
viverra venenatis. Nam accumsan libero a elit aliquet quis ullamcorper arcu tincidunt. Praesent purus turpis, consectetur quis congue vel, pulvinar at lorem. Vivamus varius condimentum dolor, quis ultricies ipsum porta quis. </p>
</li>
<li>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent euismod ultrices ante, ac laoreet nulla vestibulum adipiscing. Nam quis justo in augue auctor imperdiet. Curabitur aliquet orci sit amet est posuere consectetur. </p>
</li>
<li>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent euismod ultrices ante, ac laoreet nulla vestibulum adipiscing. Nam quis justo in augue auctor imperdiet. Curabitur aliquet orci sit amet est posuere consectetur. </p>
</li>
</ol>
The first line has a larger line height because of the large number in the list. You can resolve this issue by adding line-height: 1; to the ol li
ol li {
position: relative;
font: bold italic 45px/1.5 Helvetica, Verdana, sans-serif;
margin-bottom: 2px;
line-height: 1;
}
It appears the issue is with the font-size/line-height between the li and the p. Set the line-height for the li and p to a closer value, or 1 for the li, and use margin to separate the li items.
ol {
color: #fff;
list-style-type: decimal;
background: #152a40;
width: 100%;
margin: 50px auto;
padding: 1.2em 30px 1.2em 75px;
line-height: 0;
}
ol li {
position: relative;
font: bold italic 45px/1 Helvetica, Verdana, sans-serif;
margin-bottom: 40px;
}
li p {
font: 15px/1.5 Helvetica, sans-serif;
padding-left: 60px;
color: #eaeaea;
}
<ol>
<li>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent euismod ultrices ante, ac laoreet nulla vestibulum adipiscing. Nam quis justo in augue auctor imperdiet. Curabitur aliquet orci sit amet est posuere consectetur. Fusce nec leo ut massa viverra venenatis. Nam accumsan libero a elit aliquet quis ullamcorper arcu tincidunt. Praesent purus turpis, consectetur quis congue vel, pulvinar at lorem. Vivamus varius condimentum dolor, quis ultricies ipsum porta quis. </p>
</li>
<li>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent euismod ultrices ante, ac laoreet nulla vestibulum adipiscing. Nam quis justo in augue auctor imperdiet. Curabitur aliquet orci sit amet est posuere consectetur. </p>
</li>
<li>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent euismod ultrices ante, ac laoreet nulla vestibulum adipiscing. Nam quis justo in augue auctor imperdiet. Curabitur aliquet orci sit amet est posuere consectetur. </p>
</li>
</ol>
I am making a new web page as an exercise to learn HTML5. Unfortunately, I have encountered a very frustrating problem.
My page has a "topbar" header element that contains one "h1" element (page title) and two "nav" elements. I want the "h1" element to appear on the left side of the "topbar." I want the "nav" elements to appear on the right side of the "topbar."
Nav element "nav_secondary" contains two links, "Register" and "Sign in". This should appear at the top right corner of the "topbar." Below "nav_secondary" should appear the "nav_main" element containing a row of navigation links.
Unfortunately, my site looks all wrong. The nav elements are all the way on the left side of the topbar and are pushed off the screen. I have spent hours changing the CSS around and Googling tutorials but have yet to find a solution.
Here is a screenshot of the top half of my page:
top half of page displaying incorrectly
Here is a mock-up image of what I want it to look like:
top half of page displaying correctly mockup
Here is my HTML code:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Site Name - Page Title</title>
<link rel="stylesheet" type="text/css" href="css/styles.css">
</head>
<body>
<div class="fullscreen-bg"></div>
<header class="topbar">
<h1>Page Title</h1>
<nav class="nav_secondary">
Register
Sign in
</nav>
<nav class="nav_main">
Home
Archive
About
Contact
</nav>
</header>
<section class="bodycontainer">
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Interdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue, sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut lobortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Nullam varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Interdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue, sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut lobortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Nullam varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
</section>
</body>
</html>
Here is my CSS:
html {
height:100%;
}
body {
background: #000000;
color: #ffffff;
font-family: Helvetica Neue,Helvetica,Arial,sans-serif;
font-size: 12px;
font-style: normal;
font-variant: normal;
font-weight: 500;
line-height: 20px;
}
h1 {
font-size: 24px;
}
.fullscreen-bg {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
overflow: hidden;
z-index: -100;
background-attachment: scroll;
}
#media (min-width: 767px) {
.fullscreen-bg {
background: url('../img/background.jpg') center center / cover no-repeat;
}
}
.topbar {
background: #000000;
position: fixed;
display: block;
top: 0;
left: 0;
right: 0;
padding-left:50px;
border: none;
width: 100%;
height: 100px;
margin: none;
z-index: 999;
overflow: auto;
background: rgba(0, 0, 0, 0.85);
}
.topbar h1 {
float: left;
}
.nav_main {
float: right;
display: block;
margin-top: none;
margin-right: 50px;
margin-bottom: none;
margin-left: none;
padding-top: 0px;
padding-right: 50px;
padding-bottom: 0px;
padding-left: 0px;
font-size: 24px;
width: 100%;
height: 50px;
clear: both;
overflow: auto;
}
.nav_main a:link {
color: #ffffff;
}
.nav_main a:visited {
color: #ffffff;
}
.nav_main a:hover {
color: #C18E15;
}
.nav_secondary {
position: relative;
float: right;
display: block;
margin-top: 10px;
margin-right: 50px;
margin-bottom: none;
margin-left: none;
padding-top: 0px;
padding-right: 50px;
padding-bottom: 0px;
padding-left: 0px;
font-size: 14px;
width: 100%;
height: 50px;
clear: both;
overflow: auto;
}
.nav_secondary a:link {
color: #ffffff;
}
.nav_secondary a:visited {
color: #ffffff;
}
.nav_secondary a:hover {
color: #C18E15;
}
.bodycontainer {
padding-top: 100px;
padding-left: 25px;
padding-right: 0px;
padding-bottom: 0px;
display: block;
overflow: hidden;
margin: none;
}
.articlecontainer {
background: #000000;
padding-top: 0px;
padding-left: 25px;
padding-right: 25px;
padding-bottom: 0px;
display: block;
overflow: hidden;
float: left;
margin: 10px;
width: 300px;
height: 300px;
background: rgba(0, 0, 0, 0.85);
}
Does anyone know how I can fix this so it appears the way it should as illustrated in my mock-up? Please let me know.
Thanks!
You can do following way using display:inline-block;.
Put first line header in one div. And the give it display:inline-block; to it and and second line navbar .nav_main and vertical-align:top; and remove width:100% from both navbar.
Give both navbar to float:right to make then right align.
html {
height:100%;
}
body {
background: #000000;
color: #ffffff;
font-family: Helvetica Neue,Helvetica,Arial,sans-serif;
font-size: 12px;
font-style: normal;
font-variant: normal;
font-weight: 500;
line-height: 20px;
}
h1 {
font-size: 24px;
}
.fullscreen-bg {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
overflow: hidden;
z-index: -100;
background-attachment: scroll;
}
#media (min-width: 767px) {
.fullscreen-bg {
background: url('../img/background.jpg') center center / cover no-repeat;
}
}
.topbar {
background: #000000;
position: fixed;
display: block;
top: 0;
left: 0;
right: 0;
padding-left:50px;
border: none;
width: 100%;
height: 100px;
margin: none;
z-index: 999;
overflow: auto;
background: rgba(0, 0, 0, 0.85);
}
.firstBar > h1 {
display: inline-block;
vertical-align: top;
}
.nav_main {
float: right;
display: block;
margin-top: none;
margin-right: 50px;
margin-bottom: none;
margin-left: none;
padding-top: 0px;
padding-right: 50px;
padding-bottom: 0px;
padding-left: 0px;
font-size: 24px;
float: right;
height: 50px;
clear: both;
overflow: auto;
}
.nav_main a:link {
color: #ffffff;
}
.nav_main a:visited {
color: #ffffff;
}
.nav_main a:hover {
color: #C18E15;
}
.nav_secondary {
position: relative;
float: right;
display: block;
margin-top: 10px;
margin-right: 50px;
margin-bottom: none;
margin-left: none;
padding-top: 0px;
padding-right: 50px;
padding-bottom: 0px;
padding-left: 0px;
font-size: 14px;
display: inline-block;
vertical-align: top;
height: 50px;
clear: both;
overflow: auto;
}
.nav_secondary a:link {
color: #ffffff;
}
.nav_secondary a:visited {
color: #ffffff;
}
.nav_secondary a:hover {
color: #C18E15;
}
.bodycontainer {
padding-top: 100px;
padding-left: 25px;
padding-right: 0px;
padding-bottom: 0px;
display: block;
overflow: hidden;
margin: none;
}
.articlecontainer {
background: #000000;
padding-top: 0px;
padding-left: 25px;
padding-right: 25px;
padding-bottom: 0px;
display: block;
overflow: hidden;
float: left;
margin: 10px;
width: 300px;
height: 300px;
background: rgba(0, 0, 0, 0.85);
}
<div class="fullscreen-bg"></div>
<header class="topbar">
<div class="firstBar">
<h1>Page Title</h1>
<nav class="nav_secondary">
Register
Sign in
</nav>
</div>
<nav class="nav_main">
Home
Archive
About
Contact
</nav>
</header>
<section class="bodycontainer">
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Interdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue, sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut lobortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Nullam varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Interdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue, sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut lobortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Nullam varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
<article class="articlecontainer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusc
e ultricies nisl eget augue pellentesque, semper consequat mauris facilisis. Int
erdum et malesuada fames ac ante ipsum primis in faucibus. In luctus nisi augue,
sit amet interdum felis porta id. Nulla id orci id enim tincidunt euismod. Ut l
obortis quis arcu vitae fringilla. Fusce sagittis eget lectus vel vehicula. Null
am varius augue placerat dapibus lobortis. </p>
</article>
</section>
You may use pull-left and pull-right classes:
<header class="topbar clearfix">
<nav class="nav_secondary pull-left">
</nav>
<nav class="nav_main pull-right">
</nav>
</header>
Ooops! You haven't used bootstrap. Sorry, You may use css:
.pull-left{
float: left;
}
.pull-right{
float: right;
}
.clearfix{
overflow:hidden;/*there's others way, I just used overflow technique here*/
}
You may see this answer for further reading about clearfix techniques:
how to display image and text over another image, it looks like this site http://anilist.co/anime/20802/DigimonAdventuretri.
Hint is to use the position: relative with z-index. Basically z-index will put the elemets on top of each other when you will render it.
heres a little demo
header {
position:relative;
width:100%;
height:400px;
background:url('http://91ef69bade70f992a001-b6054e05bb416c4c4b6f3b0ef3e0f71d.r93.cf3.rackcdn.com/deep-forest-1009475.jpg')no-repeat center;
background-size:cover;
}
.img {
position:relative;
float:left;
margin:20px;
width:200px;
height:calc( 100% - 40px );
background:url('http://91ef69bade70f992a001-b6054e05bb416c4c4b6f3b0ef3e0f71d.r93.cf3.rackcdn.com/silhouetted-figure-and-tree-1008861.jpg')no-repeat center;
background-size:cover;
}
.description {
position:relative;
float:left;
margin:20px 0;
width:calc( 100% - 240px);
}
<header>
<div class="img"></div>
<div class="description">
<h2>Lorem Ipsum</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor..</p>
</div>
</header>
<section>
<h1>Actual text</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros. Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est.</p>
</section>
In your example, it feels like a container DIV with a background image, with a nested image inside said DIV.
to get a similar result for example :
HTML:
<div id="bg">
<div id="transparentContent">
<img src="imagePath" />
</div>
</div>
CSS:
#bg {
background-image: url("imagePath");
background-size: cover;
background-repeat: no-repeat;
}
#transparentContent {
background-color: rgba(0,0,0,0.5);
color: white;
}
The transparent content DIV is used to create the blackened background over the image.
There are of course, other ways to achieve similar results.