Force Navigation Bar To Stay On Line - html

I am trying to make a about page for my website. I am trying to center 3 images inside a div, equally spread out on the page, adjusting to the window size using css.
My question is:
How do I get the items to be equally spaced out in the div while having the same width on the left and right sides?
The other solutions I have read about have not actually provided me with a solution.
Here is my code:
#screamer {
border-radius: 50%;
width: 60px;
height: 60px;
background-color: rgba(255, 255, 255, 0);
background-image: url(../images/screamer.png);
background-size: 100%;
float: left;
}
#kinzu {
border-radius: 50%;
width: 60px;
height: 60px;
background-color: rgba(255, 255, 255, 0);
background-image: url(../images/screamer.png);
background-size: 100%;
float: left;
}
#swezii {
border-radius: 50%;
width: 60px;
height: 60px;
background-color: rgba(255, 255, 255, 0);
background-image: url(../images/screamer.png);
background-size: 100%;
float: left;
}
<div class="container">
<div class="row" id="managers-row">
<h4 id="managers-head">Our Managers</h4>
<div class="one-third.column" id="screamer">
</div>
<div class="one-third.column" id="kinzu">
</div>
<div class="one-third.column" id="swezii">
</div>
</div>
</div>

Just use percentage values for your width instead of pixel ones.
.column {
width: 33.333333%;
box-sizing: border-box;
padding: 0 20px;
}
box-sizing allows you to add padding to the column without making the total width greater than the target 33.333%

If need be, you may want to add a fixed with to managers-row and use auto margin
#managers-row {
width: 240px;
margin: auto;
}
#screamer {
border-radius: 50%;
width: 33.33%;
height: 60px;
background-color: rgba(255, 255, 255, 0);
background-image: url(../images/screamer.png);
background-size: 100%;
float: left;
}
#kinzu {
border-radius: 50%;
width: 33.33%;
height: 60px;
background-color: rgba(255, 255, 255, 0);
background-image: url(../images/screamer.png);
background-size: 100%;
float: left;
}
#swezii {
border-radius: 50%;
width: 33.33%;
height: 60px;
background-color: rgba(255, 255, 255, 0);
background-image: url(../images/screamer.png);
background-size: 100%;
float: left;
}
<div class="container">
<div class="row" id="managers-row">
<h4 id="managers-head">Our Managers</h4>
<div class="one-third.column" id="screamer">
Screamer
</div>
<div class="one-third.column" id="kinzu">
Kinzu
</div>
<div class="one-third.column" id="swezii">
Swezii
</div>
</div>
</div>

Used center tag in HTML, and removed float:left;
WORKING:DEMO:UPDATED
HTML
<div class="container">
<div class="row" id="managers-row">
<h4 id="managers-head">Our Managers</h4>
<center><!-- Added -->
<div class="one-third.column" id="screamer">
</div>
<div class="one-third.column" id="kinzu">
</div>
<div class="one-third.column" id="swezii">
</div>
</center>
</div>
</div>
CSS
#screamer {
border-radius: 50%;
width: 60px;
height: 60px;
background-color: rgba(255, 255, 255, 0);
background-image: url(http://www.fordesigner.com/imguploads/Image/cjbc/zcool/png20080526/1211810004.png);
background-size: 100%;
}
#kinzu {
border-radius: 50%;
width: 60px;
height: 60px;
background-color: rgba(255, 255, 255, 0);
background-image: url(http://www.fordesigner.com/imguploads/Image/cjbc/zcool/png20080526/1211810004.png);
background-size: 100%;
}
#swezii {
border-radius: 50%;
width: 60px;
height: 60px;
background-color: rgba(255, 255, 255, 0);
background-image: url(http://www.fordesigner.com/imguploads/Image/cjbc/zcool/png20080526/1211810004.png);
background-size: 100%;
}
#screamer, #kinzu, #swezii
{
display:inline-block;
}

You have some errors in your html, as well as some incorrect css. Here is what I think you are looking for:
http://jsfiddle.net/jkjzpz7z/2/
<div class="container">
<div class="row" id="managers-row">
<h4 id="managers-head">Our Managers</h4>
<div class="column one-third">
<div class="screamer"></div>
</div>
<div class="column one-third">
<div class="kinzu"></div>
</div>
<div class="column one-third">
<div class="swezii"></div>
</div>
</div>
</div>
.column {
float: left;
}
.one-third {
width: 33.33%;
}
#managers-row {
width: 500px; /* Demo Only */
text-align: center;
}
.screamer,
.kinzu,
.swezii {
display: inline-block;
width: 60px;
height: 60px;
border-radius: 50%;
background-color: #000; /* Demo Only */
background-size: 100%;
}
.screamer {
background-image: url(../images/screamer.png);
}
.kinzu {
background-image: url(../images/screamer.png);
}
.swezii {
background-image: url(../images/screamer.png);
}

Use percentages, and remove white space between DIV elements(really annoying)
JS Fiddle
.one-third-column {
width: 33.333333333%;
display: inline-block;
}
.one-third-column img {
width: 100%;
height: auto;
background-color: red;
}
.one-third-column > div {
padding: 15px 15px 15px 15px;
}
<div class="container"><div class="row" id="managers-row"><h4 id="managers-head">Our Managers</h4><div class="one-third-column"><div><img src="http://png-3.findicons.com/files/icons/1072/face_avatars/300/i02.png"></div></div><div class="one-third-column"><div><img src="http://png-3.findicons.com/files/icons/1072/face_avatars/300/i02.png"></div></div><div class="one-third-column"><div><img src="http://png-3.findicons.com/files/icons/1072/face_avatars/300/i02.png"></div></div></div></div>

None of the other answers helped. I ended up using margin-left:10px; on the left aligned div, text-align:center; and display:inline-block; to center the middle div. Lastly I used a margin-right:10px; to align the right div.

Related

Clip-path, z-index on 3 different items

I have a request from my client to do somehting like this (css only):
On the background, have a color, sectionned on the bottom
On the right side, have a text block, sectionned on top and bottom
Between them, show an image
As you can see here. But the problem, is that the bottom of the image should follow the sectionned part of the 1 layer.
As far as I know, it's not possible to achieve such thing because of how the css is working, because the image can't be "behind" the 1 layer and in front of the 3d.
So far, I have my 2nd layer working well (I used the clippy website to help me).
The when I try to apply the clippath 1 layer, it also clips the 2nd (as expected by clippath)
This is the html of the last try i've done
<div class="parent">
<div style="background: green">
<div class="left-content" style="background: green">
<p class="top-titre">title</p>
</div>
<div class="center-content" style="background: green">
<div>
<img src="..." alt="">
</div>
</div>
<div class="right-content">
<div class="clip-top" style="background: yellow"></div>
<div class="d-flex flex-column content" style="background: yellow">
<p>subtitle</p>
<p>description</p>
</div>
<div class="clip-bottom" style="background: yellow"></div>
</div>
</div>
<div class="clip-bottom" style="background: #000000"></div>
</div>
and the last css
.parent {
margin: auto;
display: flex;
flex-direction: column;
width: 85%;
> .clip-bottom {
width: 100%;
height: 100px;
clip-path: polygon(100% 0, 0 0, 0 70%);
}
> div {
position: relative;
padding: 0 120px 0 95px;
width: 100%;
display: flex;
//clip-path: polygon(0 0, 100% 0, 100% 85%, 0% 100%);
.left-content {
width: 20%;
display: flex;
position: relative;
z-index: 5;
p {
color: white;
font-size: 2em;
font-weight: bold;
}
}
.center-content {
width: 25%;
position: relative;
img {
position: absolute;
bottom: 0;
left: 100%;
transform: translateX(-50%);
z-index: 20;
}
}
.right-content {
position: relative;
z-index: 10;
width: 55%;
.content {
padding: 40px 50px 60px 300px;
.field--name-field-titre {
.field__item {
font-size: 1.5em;
font-weight: bold;
}
}
.field--name-field-description {
padding: 70px 0 90px;
}
}
.clip-top, .clip-bottom {
height: 100px;
}
.clip-top {
clip-path: polygon(100% 30%, 0 100%, 100% 100%);
}
.clip-bottom {
clip-path: polygon(100% 0, 0 0, 100% 70%);
}
}
}
}

How to opacify only the background outline?

I want to opacify just the outline of the background, that small part between the yellow container and the end of the VP. Could you please help me? Thank you.
HTML
`e
.menu-jumbotron {
background: #160b00;
background-image: url("/Users/Desktop/PROJECTS/STELLINA 2/images/food-img.jpg");
background-size: cover;
max-width: 100%;
}
.jumbotron-form {
background: #160b00 !important;
}
.border {
width: 100%;
height: 40.58rem;
border: 2px solid #fed675 !important;
}
.opacity-bg {
width: 65%;
height: 100%;
background: rgba(22, 11, 0, 0.9);
}
<section class="welcome-section">
<div class="jumbotron menu-jumbotron jumbotron-fluid">
<div class="container menu-container">
<div class="border">
<div class="opacity-bg">
<div class="headers">
<h3 class="inner-text small">vieni a trovarci</h3>
<h1 class="header display-4">Etoile Food Bar & Cocktails</h1>
</div>
<div class="phone-number-outer">
<div class="phone-number-inner">
<p>123-456789</p>
</div>
</div>
<div class="menu-button">
<button type="button" class="menu-btn btn btn-primary button-wrapper">Scopri il nostro menu</button>
</div>
</div>
</div>
</div>
</div>
</section>
Background that I want to opacify`
Is this what you try to achieve?
.menu-jumbotron {
background-color: #c7731f;
background-image: url('https://via.placeholder.com/1000x1000.jpg');
background-size: cover;
max-width: 100%;
}
.jumbotron-form {
background: #160b00 !important;
}
.border {
display: flex;
width: 100%;
height: 40.58rem;
border: 2px solid #fed675 !important;
}
.opacity-bg {
width: 65%;
height: 100%;
background: rgba(22, 11, 0, 0.5);
}
<section class="welcome-section">
<div class="jumbotron menu-jumbotron jumbotron-fluid">
<div class="container menu-container">
<div class="border">
<div class="opacity-bg">
<div class="headers">
<h3 class="inner-text small">vieni a trovarci</h3>
<h1 class="header display-4">Etoile Food Bar & Cocktails</h1>
</div>
<div class="phone-number-outer">
<div class="phone-number-inner">
<p>123-456789</p>
</div>
</div>
<div class="menu-button">
<button type="button" class="menu-btn btn btn-primary button-wrapper">Scopri il nostro menu</button>
</div>
</div>
</div>
</div>
</div>
</section>
This was an interesting problem to tackle. I came up with two possible ideas: one is somewhat complex but uses true opacity, and the other is simpler but uses a trick to fake opacity.
True Opacity Solution
The idea is to use two background images. The first one will have opacity applied to it, and the other will not. Two images are required since, to my knowledge, you can't apply opacity to just part of the image.
* {
margin: 0;
}
section.welcome {
--padding: 3em;
--border-width: 0.25em;
position: relative;
padding: var(--padding);
}
.bg {
position: absolute;
background-image: url('https://wallpapercave.com/wp/1OXITrf.jpg');
background-size: cover;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: -1;
}
section.welcome > .bg {
opacity: 0.25;
}
.inner {
position: relative;
border: var(--border-width) solid red;
overflow: hidden;
}
.inner .bg {
background-position: calc(var(--padding) * -1 - var(--border-width)) calc(var(--padding) * -1 - var(--border-width));
width: calc(100% + 2 * var(--padding) + 2 * var(--border-width));
}
.content {
color: #fff;
background: rgba(0, 0, 0, 0.75);
min-height: 10em;
width: 65%;
}
<section class="welcome">
<div class="bg"></div>
<div class="inner">
<div class="bg"></div>
<div class="content">
<p>Hello world</p>
</div>
</div>
</section>
The trickiest bit is getting the images to align. Since there are two background images at play, in order for the effect to look cohesive, background-position must be carefully calculated so it aligns with the opacity-ified image.
The key line, which moves the inner image backwards by an amount equal to the welcome sections padding and the content's border width:
background-position: calc(var(--padding) * -1 - var(--border-width)) calc(var(--padding) * -1 - var(--border-width));
Using Shadow to Fake Opacity
Opacity is used to allow part of the background to show through. If you know that the background is white or some other color, then you can fake opacity by using box-shadow. This solution is simpler since it only requires one background image now, but you still want to calculate the size of the shadow for best effect.
* {
margin: 0;
}
section.welcome {
--padding: 3em;
--border-width: 0.25em;
position: relative;
padding: var(--padding);
background-image: url('https://wallpapercave.com/wp/1OXITrf.jpg');
background-size: cover;
}
.inner {
border: var(--border-width) solid red;
box-shadow: 0 0 0 calc(var(--border-width) + var(--padding)) rgba(255, 255, 255, 0.75);
}
.content {
color: #fff;
background: rgba(0, 0, 0, 0.75);
min-height: 10em;
width: 65%;
}
<section class="welcome">
<div class="inner">
<div class="content">
<p>Hello Woorld</p>
</div>
</div>
</section>

I want to have an image align left with the text in the <h1> tags below but am trouble finding a solution

I need to have a second image align left of the text but layered on top of the background image. I am having some trouble figuring out what css I need to make this work. Currently everything I have tried messes with the text positioning or the background image.
Luckily, this is a personal project so there is no timeline but I would appreciate any help that could be given.
I just started learning web development this past year so it all still feels a little new to me.
.hero-full-container {
height: 100vh;
position: relative
}
.background-image-container {
background-size: cover;
background-repeat: no-repeat;
background-position: 50%
}
.white-text-container h1 {
color: #fff
}
.overlay-gradient {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, .3), transparent);
background-image: -o-linear-gradient(top, rgba(0, 0, 0, .3) 0, transparent 100%);
background-image: linear-gradient(180deg, rgba(0, 0, 0, .3) 0, transparent);
background-repeat: repeat-x;
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr="#4D000000", endColorstr="#00000000", GradientType=0)
}
.container {
margin-right: auto;
margin-left: auto;
padding-left: 15px;
padding-right: 15px
}
.row {
margin-left: -15px;
margin-right: -15px
}
.col-xs-12 {
position: relative;
min-height: 1px;
padding-left: 15px;
padding-right: 15px
}
.col-md-7 {
width: 58.33333%
}
.col-md-offset-1 {
margin-left: 8.33333%
}
.hero-full-wrapper .text-content {
padding-top: 30%
}
<div class="hero-full-container background-image-container white-text-container" style="background-image:url('./assets/images/home_01.jpg')">
<div class="overlay-gradient"></div>
<div class="container">
<div class="row">
<div class="col-xs-12 col-md-7 col-md-offset-1">
<div class="hero-full-wrapper">
<div class="text-content">
<h1>William</h1>
<h1>Mark</h1>
<h1>Derichsweiler</h1>
<!--<p>Lorem ipsum</p>-->
</div>
</div>
</div>
</div>
</div>
</div>
I don't undestand very well your question, but if you want to have a background image and another image above this image, you can do this creating more div. Once you insert a background image, you can insert another div inside this div, e.g. :
<div class="main-container">
<div class="second-image">
<img src="link_to_your_image">
</div>
<div class="text-area">
<h1>William</h1>
<h1>Mark</h1>
<h1>Derichsweiler</h1>
</div>
</div>
and the for css, you can use flex property, setting the direction to flex-direction: row, e.g. :
*{
margin: 0;
padding: 0;
}
html, body {
height: 100%;
}
.main-container {
width: 100%;
height: 100%;
background-image: url('link_to_your_image');
background-color: red;
display: flex;
flex-direction: row;
align-items: center;
}
.second-image, .text-area {
margin-left: 50px;
}
I hope this can help you, have a nice day.

CSS position relative top 50% of div doesn't work

I have problem with positioning:
I cannot set exactly top: 50% and left: 50% on both photo and text because it isn't 50%. I try by hand set that 50% which is more like 46%.
When I change size of window text moves. I don't know what to Do and I am looking for answer for 2 hours
.photo-box {
background: linear-gradient(250deg, rgba(251, 10, 237, 0.84), rgba(0, 186, 255, 0.91) 50%, rgba(15, 226, 98, 1));
width: 100vw;
text-align: center;
font-size: 30px;
padding-top: 70px;
padding-bottom: 70px;
margin-left: auto;
margin-right: auto;
color: #f0eeee;
font-family: sans-serif;
position: relative;
}
.tytul {
display: flex;
text-align: center;
position: absolute;
top: 46%;
left: 45.3%;
}
.zdj-pierw img {
border-radius: 100px;
align-items: center;
justify-content: center;
}
<div class="photo-box" style="">
<div class="tytul">Strona WWW </div>
<div class="zdj-pierw">
<img src="https://picsum.photos/200/200/?random" width="200" height="200" />
</div>
</div>
You should be using flex properties on the parent, not just on the item you want to place.
I've also changed your border-radius to 50%, as this is a perfect round, no matter what the size of the image.
.photo-box {
background: linear-gradient(250deg, rgba(251, 10, 237, 0.84), rgba(0, 186, 255, 0.91) 50%, rgba(15, 226, 98, 1));
width: 100vw;
font-size: 30px;
padding-top: 70px;
padding-bottom: 70px;
color: #f0eeee;
font-family: sans-serif;
position: relative;
display: flex;
justify-content: center;
align-items: center;
}
.tytul {
position: absolute;
}
.zdj-pierw img {
border-radius: 50%;
}
<div class="photo-box" style="">
<div class="tytul">Strona WWW </div>
<div class="zdj-pierw">
<img src="https://picsum.photos/200/200/?random" width="200" height="200" />
</div>
</div>

How to set a background inside a div

Final resulting background image that I need:
Background image that I have used:
But I have got this Fiddle
::Summary of Fiddle::
HTML...
<div id="top-part">
<div id="topmost">
<div id="top-most" class="wrapper">
</div>
</div>
<div id="topmenu" class="wrapper">
</div>
CSS...
.wrapper{
position: relative;
width: 943px;
margin: 0 auto;
}
#top-part{
background: url(img/bg-header-effects.png) no-repeat top center;
}
#topmost{
background: #900;
opacity: 0.8;
}
#top-most{
height: 139px;
}
#topmenu{
background: #900;
opacity: 0.8;
height: 51px;
border-radius: 0 0 20px 20px;
}
Update - to cover your recent edit
#header{
background: #f00 url('http://i.stack.imgur.com/GWVfL.jpg');
opacity: .6;
width: 100%;
height: 189px;
}
Working Fiddle
You could try using the background property in CSS:
div{
background: url('path_to_your_image.jpg') no-repeat;
}
Learn more about using the background-image property here
Note:
There is a difference between background and background-image. In this answer I've used the background property which basically takes all of the possible options for a background image in CSS and lets them be used in a single call.
For example, you could split the above up into two selectors:
div{
background-image: url('path_to_your_image.jpg') no-repeat;
background-repeat: no-repeat;
}
You could do like this fiddle
html...
<div id="top-part">
<div id="topmost">
</div>
</div>
<div id="top-menu" class="wrapper">
<div id="topmenu">
</div>
</div>
css...
.wrapper{
position: relative;
width: 943px;
margin: 0 auto;
}
#top-part{
background: url(img/bg-header-effects.png) no-repeat top center;
}
#topmost{
background: #900;
opacity: 0.8;
height: 139px;
}
#top-menu{
background: url(img/bg-header-effects.png) no-repeat 50% 45%;
border-radius: 0 0 20px 20px;
}
#topmenu{
background: #900;
opacity: 0.8;
height: 51px;
border-radius: 0 0 20px 20px;
}
The easy approach that I'm thinking of is having a picture within divs covering the whole page. The code will be very simple, but the only downside is the image may be warped or it can be clicked on unless you have this.
HTML:
<div id="backgroundcolor">
<div id="backgroundimage">
</div>
</div>
CSS:
#backgroundcolor {
background-color: #000;
z-index: 1;
}
#backgroundimage {
background: ("http://cdn.theatlantic.com/static/infocus/election110712/s_e01_37923312.jpg");
resize: none;
object-position: center;
object-fit: initial;
}