css stylings:
.products {
display: inline-block;
position: relative;
align-items: ;
margin-top: -4px;
}
.product-cell {
float: left;
display: inline-block;
width: 50%;
box-sizing: border-box;
}
.product-img {
position: relative;
}
.product-overlay {
background: rgba(0, 0, 0, 0.73);
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
z-index: 1;
}
p.product-name {
position: absolute;
top: 40%;
color: #fff;
z-index: 2;
left: 38%;
font-family: 'Kaushan Script', cursive;
transform: translate(-30%,40%);
font-size: 30px;
}
.product-list {
padding: 5px 0px 0px 10px;
}
HTML code:
I am using bootstrap.but for mobile i am not getting expected output as shown in the images below.for mobile i made .product-cell width as 100%. if it possible us js fiddle to explain.thanks for your valuable information.
i need like this :
.
but I am getting like this:
<div class="products">
<div class="product-cell">
<div class="product-img">
<img src="images/products-electronic.png" class="img-responsive" >
<div class="product-overlay"></div>
<p class="product-name">ELECTRONICS ENGINEERING</p>
</div>
</div>
You need to make your website responsive, to do that we use something called media queries which is basically just extra markup in your css syntax.
A great framework to use since you're just starting out with responsive design would be using Bootstrap, it's easily customised to fit the needs of your project.
This should also help give you a better understanding about how fluid grid systems are incorporated into your site.
Hope this helps!
Related
Here is my demo: https://stackblitz.com/edit/js-6whwk2?file=style.css
here is the code
HTML
<div class="my-overlay" padding [hidden]="overlayHidden">
<ion-card class="card">
<ion-card-content>
Explore the App! See how everwell can help you achive your health goals.
</ion-card-content>
</ion-card>
<div class="circle" (click)="hideOverlay()"></div>
</div>
CSS
.card {
background-color: white;
}
.circle {
box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.4);
justify-content: center;
flex-direction: column;
align-items: center;
border-radius: 100%;
display: flex;
height: 64px;
width: 64px;
float: right;
position: relative;
top: 100%;
transform: translateY(-100%);
}
.my-overlay {
position: fixed;
width: 100%;
height: 100%;
z-index: 20;
top: 0;
left: 0;
}
ion-card {
height: 9% !important;
--color: #434d65;
border-radius: 12px;
bottom: 64px;
position: absolute;
}
ion-card-content {
padding-top: 11px;
font-size: 14px !important;
font-style: normal !important;
font-weight: normal !important;
line-height: 20px !important;
}
What I want to achieve is to be able to place my ion-card above the overlay, to be visible and not beneath it how it's now. I tried to remove this from the class .cirle (see below), but this leads me to another problem which is the position of the circle which I can, of course, make it with margin to be placed on the right bottom of the page, but that's not responsive and doesn't look like a good approach.
position: relative;
top: 100%;
transform: translateY(-100%);
I am new to coding and I am doing this as I learning project and I am struggling for a few days. If anyone has any suggestion I would really appreciate it. Thanks a lot.
Try using z-index: 1 :)
The z-index basically helps you determine the level of the item.
More here:
https://developer.mozilla.org/en-US/docs/Web/CSS/z-index
or for an easier read, since you're new to coding: https://www.w3schools.com/cssref/pr_pos_z-index.asp
I'm developing a website only using HTML, CSS and Javascript, it is my first web page, and I'm getting a problem of the height on a fixed block. The "Contact us" link must open a box with the contact information in the center of the screen, so I used the fixed position, I wanted the height to work as usual, I mean only the height of it's content, but instead, it is showing 100% height of the screen, thank you, the web page is in Spanish, the link to the web site is:
http://www.bordadosyalgomas.com.ve/
Again, this is my first web page, plus I'm on the navigation bar by the time.
EDIT:
Sorry, first time asking, I didn't provide any code:
div#contacts1{
font-family: "Ubuntu Medium";
padding: 3.5em;
width: 50%;
border: solid 2px;
border-radius: 20px;
background-color: white;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
overflow: auto;
}
div#contacts{
width: 100%;
height: 4000px;
background-color: rgba(0,0,0,0.8);
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
}
div#contacts1 img{
height: 60px;
display: inline-block;
vertical-align: middle;
}
div#contacts1 p{
font-size: 1.3em;
display: inline-block;
padding: 0;
margin: 0;
vertical-align: middle;
padding-left: 1.5em;
}
div#contacts1 p strong{
display: block;
font-size: 0.9em;
margin: 0;
margin-bottom: 0.2em;
padding: 0;
}
div.cparador{
height: 100px;
margin-bottom: -1em;
display: block;
}
div.cparador img{
-webkit-filter: drop-shadow(-2px 2px 4px black);
filter: drop-shadow(-2px 2px 4px black);
margin-left: 3em;
}
div.cparador h1{
text-align: center;
margin: 0;
}
<!DOCTYPE html>
<html>
<head>
<title>Bordaos y algo mas</title>
<style type="text/css">
#import url("index.css") screen;
</style>
</head>
<body>
<div id="contacts">
</div>
<div id="contacts1">
<div class="cparador">
<h1>Información de contacto:</h1>
</div>
<div class="cparador">
<img src="contacts/phone.png">
<p><strong>Teléfono</strong>
0257-2535145</p>
</div>
<div class="cparador">
<img src="contacts/telegram.png">
<p><strong>Telegram</strong>
#bordados.ym</p>
</div>
<div class="cparador">
<img src="contacts/instagram.png">
<p><strong>Instagram</strong>
#bordados.ym</p>
</div>
<div class="cparador">
<img src="contacts/mail.png">
<p><strong>Correo Electrónico</strong>
bordados.ym#gmail.com</p>
</div>
<div class="cparador">
<img src="contacts/whats.png">
<p><strong>Whatsapp</strong>
0414-5214041</p>
</div>
</div>
</body>
</html>
A picture of the problem
You need to remove bottom:0; - this combined with top:0; causes the div to take 100% height.
Then you can set:
top: 50%; // move popup down by 50% of window height
transform: translateY(-50%); // move it back by 50% of popup height
EDIT:
also consider adding max-height: 100%; to make use of overflow: auto; when height of the window is shorter than popup's height.
There is a simple example of a Modal You can use, and instead of any extraa Custom CSS(Specially Height-Width) leave that simple.
that auto height according to your contents!
link- https://getbootstrap.com/docs/4.0/components/modal/
Page Example: https://codepen.io/anthonyhvelazquez/pen/qBBVjBX
The example I posted is a working example of the template I want to have. I have 2 fixed height headers and the rest of the content-container will fill the height of the parent. Anything within the content-container will auto scroll if the child's content is larger than the the content-container. I know there are other functions like minmax, and fit-content and wanted to make sure there isnt a better/more responsive way of setting up the page.
Some other questions I had regarding grids:
If I wanted to have a hidden header that appears and disappears on the click of a button, would it be better using a grid system and trying to animate the grid rows to a height of 0 or would it be better setting up the container as a vertical flex container and modifying the height of the navbars themselves
If I tried to implement this in Angular, would I have to wrap my components in div containers with the grid location style to place them in a grid template properly or can I add the styling to the component itself like so:
<div style="grid-row: 1/2">
<app-component></app-component>
</div>
// or
<app-component style="grid-row: 1/2"></app-component>
The codepen demo is not responsive and to your question. Is it the most responsive method? No, it is not.
With grid system you can make any layout you can think of, but not everywhere you need it.
You can simply use Flex and it will be responsive as well.
I am adding code for a normal web layout. having Header, hero section
content and para and all be responsive. Feel free to go through them and understand them. Feel free to ask anything regarding it. I will help as much I can.
In Angular, you can make components like header, footer and add the respective HTML tags and CSS for the components and imports it in your home page component. Hope this helps.
For two fixed header you can just increse the height of the header in its class. But you have to use js for adding click function and doing the changes in height of that header class.
For the particular example, I had just used flex here.
body, html{
padding: 0px;
margin: 0px ;
box-sizing: border-box;
}
.header{
z-index: 10;
height: 80px;
width: 100%;
position: fixed;
background: linear-gradient( 160deg, #00689b 0%, #00adef 100%);
box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.06);
}
.header .logo{
width: 190px;
height: auto;
position: absolute;
top: 54%;
left: 135px;
transform: translate(-50%, -50%);
cursor: pointer;
color: white;
}
.header-links{
display: flex;
flex-direction: row;
float: right;
padding: 9px 20px;
color: white;
font-size: 18px;
}
.header-links span{
padding: 20px;
}
.hero-section{
width: 100%;
height: 80vh;
position: relative;
background-color: turquoise;
top: 80px;
}
.hero-section img{
width: 100%;
height: 80vh;
object-fit: cover;
position: absolute;
}
.hero-section h1{
position: absolute;
text-align: center;
color: white;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.contents-container{
padding: 5% 5%;
position: relative;
width: 100%;
min-height: 100vh;
}
.h-features-container{
padding-top: 20px;
height: auto;
width: 100%;
position: relative;
background-color: white;
z-index: 1;
}
.h-features-container >h3{
justify-content: center;
text-align: center;
font-size: 28px;
color: #111;
}
.features-card-container{
display: flex;
flex-direction: row;
justify-content: center;
flex-wrap: wrap;
margin-top: 10px;
padding: 50px 9%;
box-sizing: border-box;
}
.features-card{
width: 300px;
height: 412px;
background-color: red;
padding: 20px;
margin: 19px;
border-radius: 2px;
background: #fff;
box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.16);
}
.features-card h3{
text-align: center;
}
.features-card p{
font-size: 16px;
}
/* footer */
.h-footer{
min-height: 50vh;
width: 100%;
position: relative;
bottom: 0px;
padding: 0%;
background: linear-gradient( 90deg, #00689b 0%, #00adef 100%);
}
.h-footer-flex{
display: flex;
flex-direction: row;
flex-wrap: wrap;
color: white;
white-space: nowrap;
padding: 20px 20px;
}
.h-copywrite{
text-align: center;
color: white;
position: relative;
}
.f-box{
height: 60%;
width: 25%;
padding: 20px;
margin: 20px;
}
.f-box p{
position: relative;
}
.f-box>p>a{
cursor: pointer;
}
.f-box-links:before {
content: '';
position: absolute;
background: white;
width: 0px;
height: 1px;
top: 20px;
opacity: .8;
transform: translate(0%, 0%);
transition: all 0.3s ease;
}
.f-box-links:hover:before {
width: 25px;
}
.social-icon-1{
margin-left: -8px;
}
#media screen and (max-width:1200px){
.f-box{
height: 60%;
width: 28%;
padding: 20px;
margin: 20px;
}
}
#media screen and (max-width:999px){
.f-box{
height: 60%;
width: 26%;
padding: 20px;
margin: 20px;
}
}
<header class="header">
<div class="logo">
<h2>Main Logo</h2>
</div>
<div class="header-links">
<span>Products</span>
<span>Features</span>
<span>Contact</span>
</div>
</header>
<div class="hero-section">
<img src="https://source.unsplash.com/random">
<h1>This is a simple heading</h1>
</div>
<div id="features-container" class="h-features-container">
<h3>Our Products</h3>
<div class="features-card-container">
<div class="features-card">
<h3>Inventory Management</h3>
<p>Inventory Management Software enables you to Manage Your assets The way you want you can
arrange your assets in a way that helps you to keep easy track.
</p>
</div>
<div class="features-card">
<h3>Order Management</h3>
<p>Stock Management Software enables you to Manage Your asstes The way you want you can
arrange your assets in a way that helps you to keep easy track.
</p>
</div>
<div class="features-card">
<h3>Employee Management</h3>
<p>Stock Management Software enables you to Manage Your asstes The way you want you can
arrange your assets in a way that helps you to keep easy track.
</p>
</div>
<div class="features-card">
<h3>Payroll Management</h3>
<p>Stock Management Software enables you to Manage Your asstes The way you want you can
arrange your assets in a way that helps you to keep easy track.
</p>
</div>
<div class="features-card">
<h3>Attendence System</h3>
<p>Stock Management Software enables you to Manage Your asstes The way you want you can
arrange your assets in a way that helps you to keep easy track.
</p>
</div>
</div>
</div>
<!-- footer -->
<footer class="footer">
<div class="h-footer">
<div class="h-footer-flex">
<div class=" f-box">
<p> <a class="f-box-links">Home</a></p>
<p> <a class="f-box-links">Features</a></p>
<p><a class="f-box-links">Clients</a></p>
<p><a class="f-box-links">Why Us</a></p>
<p><a class="f-box-links">Contact Us</a></p>
</div>
<div class=" f-box">
<p> <a class="f-box-links">Terms and Condition</a></p>
<p> <a class="f-box-links">Privacy Policy</a></p>
</div>
<div class=" f-box">
<p>Follow us</p>
<p>Facebook</p>
<p>Instagram</p>
</div>
</div>
<p class="h-copywrite">© 2019 website.in All Rights Reserved</p>
</div>
</footer>
I'm finishing a webpage using wordpress as a CMS. and my client asked me to put an image/button at the very top of the page.aligned to the main navigation menu.
That's OK, I did it but what happened is this:
when I use different screen resolution, the buttons do not stay aligned with the very top of the page
I've tried to use "Position: fixed", but with that, the buttons move with the page and I want them to stay at the top of the page and don't scroll along with the page.
How can I do that? Can someone help me? Thanks!!!
.buttons {
position: absolute;
left: 85%;
z-index:905;
margin-top:0
}
.buttonLang {
position: relative;
z-index: 910;
}
.buttonZone {
position: relative;
z-index: 915;
top: -107px;
left: 100px;
}
.selectLang {
display: none;
position: absolute;
left: 0;
bottom: 5px;
right: 0;
background-color: rgba(0,0,0,1);
}
#buttonLang:hover img {
opacity: 1;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: /*#2893CC;
*/#FFFFFF;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,1);
padding: 12px 16px;
z-index: 1;
font-family: Calibri;
}
.dropdown:hover .dropdown-content {
display: block;
line-height: 200%;
}
</head>
<body>
<body bgcolor="#E1E1E1">
<div class="buttons">
<div class="buttonLang">
<div class="dropdown">
<img src="http://www.jourdan.org.br/wp-content/uploads/button-lang.png" alt="" title=""/>
<div class="dropdown-content">
<img src="http://localhost/wp-content/uploads/2016/10/flag-bra.png" width="30"alt="" title=""/> Português</br>
<img src="http://localhost/wp-content/uploads/2016/10/flag-esp.png" width="30"alt="" title=""/> Español</br>
<img src="http://localhost/wp-content/uploads/2016/10/flag-usa.png" width="30"alt="" title=""/> English
</div>
</div>
</div>
<div class="buttonZone">
<img src="http://www.jourdan.org.br/wp-content/uploads/button-sgvzone.png" alt="" title=""/>
</div>
<!-- begin snippet: js hide: false console: true babel: false -->
Add this to your CSS:
.post > .post-content > .wpb_row > .wpb_column {
position: static;
}
.buttons {
position: absolute;
right: 10%;
top: 0;
z-index: 905;
margin-top: 0px;
}
However I don't understand why you don't move the buttons HTML into the header. When you resize the browser, the buttons overlap the navigation and this can't be corrected with just a few lines of CSS.
Try position: absolute; instead. Also top: 0px; should keep it stuck there.
body{position :relative;} .button{position:absolute; top:0px; left:10px;}
Align them to the right instead of left :)
.buttons {
position: absolute;
right: 10%; /* for example, adjust how you need */
z-index:905;
margin-top:0
}
So I was wondering how can I make the box stops exactly before it go through the text. The box is just floating under the text, I want to make it stop floating before it hits.
Normal Size
Window resized
HTML:
<div class="program"></div>
<span class="but">
<h2 class="zaglavie">CSGOFREEITEMS <span class="beta">0.5.1</span></h2>
<p class="opisanie"><b>Ultimate platform</b>. The easiest way to have fancy inventory. Get the item you want just in <b>seconds</b>.</p>
<div class="buttons">
<a class="button1" href="#above"></a>
<a class="button2" href="#above"></a>
<span style="float: right; color: white; margin-right: 2px; margin-top: 1px; font-size: 10.5px;">for only <b>$4.99</b>/month</span>
</div>
</span>
<br>
CSS:
.but
{
position: absolute;
top: 90px;
font-family: Verdana;
display: block;
}
.zaglavie
{
font-family: 'Open Sans', sans-serif;
color: #e5e5e5;
font-size: 31px;
text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.39);
position: relative;
left: 70px;
top: 100px;
font-weight: 700;
}
.opisanie
{
font-family: 'Open Sans', sans-serif;
color: #fefefe;
text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.39);
font-size: 16px;
left: 70px;
top: 90px;
position: relative;
width: 400px;
}
.buttons
{
margin-left: 70px;
margin-top: 120px;
width: 375px;
height: 57px;
}
.button1
{
display:block;
width: 227px;
height: 57px;
background-image: url(images/button1.png);
background-repeat: no-repeat;
float: left;
}
.button2
{
display:block;
width: 136px;
height: 57px;
background-image: url(images/button2.png);
margin-left: 240px;
}
.program
{
display:block;
width: 665px;
height: 745px;
background-image: url(images/sosi2.png);
background-repeat: no-repeat;
right: 50px;
position: relative;
float: right;
}
Weave: http://kodeweave.sourceforge.net/editor/#4fc7d9522497eba555377ed94d364ee3
CSS Media Queries are a good solution for your problem.
I made a simple snippet here to show you how they work. You can utilize them with your site to fix the problem.
What I decided to do here is use display: table; and table-cell to center your elements.
I then used media queries to change the element from display: table; to display: block;
In addition I change your program background image to an image element as it's easier to style and handle upon page resize.
I converted your images to Base64 aka DataURL (because I'm on a tablet and it's easier to test without extra http requests.
Here's a very simple example of how you can solve your problem with media queries
You can view this weave for a more extensive solution (ex display: table; and table-cell).
.left, .right {
position: absolute;
top: 0;
bottom: 0;
padding: 1em;
}
.left {
left: 0;
right: 50%;
background: #93e9ff;
}
.right {
right: 0;
left: 50%;
background: #47ffaf;
}
#media all and (min-height: 300px) {
.left, .right {
position: absolute;
left: 0;
right: 0;
}
.left {
top: 0;
bottom: 50%;
}
.right {
bottom: 0;
top: 50%;
}
}
<div class="left">left content</div>
<div class="right">right content</div>
You can use Bootstrap and you will have a nice responsive design for your page.
This is your code with bootstrap, without css and using the images in the HTML section:
<!Doctype html>
<html>
<head>
<meta charset ="utf-8">
<!--Bootstrap-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">
</head>
<body>
<div class="container-fluid">
<div class="row">
<!--you can change that numbers to adapt your page to another devices like tablets-->
<!--if you see, the numbers are a proportion of 12, in this case, 5:7 (check the last div)-->
<div class="col-xs-5 col-sm-5 col-md-5 col-lg-5">
<span class="but">
<h2 class="zaglavie">CSGOFREEITEMS <span class="beta">0.5.1</span></h2>
<p class="opisanie"><b>Ultimate platform</b>. The easiest way to have fancy inventory. Get the item you want just in <b>seconds</b>.</p>
<div class="buttons">
<a class="button1" href="#above"><img src="images/button1.png"></a>
<a class="button2" href="#above"><img src="images/button2.png"></a>
<span style="float: right; color: white; margin-right: 2px; margin-top: 1px; font-size: 10.5px;">for only <b>$4.99</b>/month</span>
</div>
</span>
</div>
<!--if you see, the numbers are a proportion of 12, in this case, 5:7-->
<div class="col-xs-7 col-sm-7 col-md-7 col-lg-7">
<img class="img-responsive" src="images/sosi2.png">
</div>
</div> <!-- end row -->
</div> <!-- end container-fluid -->
</body>
You can implement your css from here and you will see that will be more easy and solid.
See http://getbootstrap.com/components/
Or https://www.youtube.com/watch?v=3cYWiU_HsgM (a nice tutorial of Bootstrap 3)
Hope this helps.