i have a slideshow built on my landing page but, what i am wanting to do is have that slideshow scale down and scale in relation to the page. i have managed to do this with all other divs/content it is just this pesky slideshow that's not doing as it is told. It is probably something very simple but i have been staring at this site a bit TOO much now.
css:
.slideshow {
margin: 0px 5px 5px 5px;
position: relative;
width: 920px;
height: 610px;
}
#slide2, #slide3, #slide4, #slide5, #slide6, #slide7, #slide8 {
position: absolute;
width: 520px;
height: 156px;
padding: 227px 200px 227px 200px;
text-align: center;
color: #FFF;
}
#slide1 {
position: absolute;
width: 520px;
height: 20px;
padding: 295px 200px 295px 200px;
text-align: center;
color: #FFF;
}
Snippet of HTML:
<!--Slideshow-->
<div class="slideshow">
<!--We design and communicate-->
<div id="slide1">
<span style="line-height: 120%; color: #FFF; font-size: 20px; font-weight: normal;">
We are a design and communication agency.
</span>
</div>
<div id="slide3"><a href="about/how-we-work.htm">
<span style="line-height: 120%; color: #FFF; font-size: 20px; font-weight: normal;">
We create.
<br>
<br>
branding / web design / packaging / events / press launches / interiors / installations
<br>
<br>
<span style="border-bottom: solid 3px #FFF;">
our process
</span>
</span>
</a></div>
<!--Bloom and Blossom-->
<div id="slide2"></div>
<!--Elkin-->
<div id="slide4"></div>
<!--GKFW-->
<div id="slide6"></div>
<!--Swarovski-->
<div id="slide7"></div>
<!--ASOS-->
<div id="slide8"></div>
</div>
my aim is to have this taking up 100% width like all the other divs.
Thanks if anyone can help and apologies in advance for some appalling coding! hah u__u been out the game too long.
this is the MQ stylesheet that i have:
.slideshow {
margin: 0 5px 5px 5px;
position: relative;
width:98%;
}
#slide2, #slide3, #slide4, #slide6, #slide7, #slide8 {
position: absolute;
width: 98%;
margin: 0px 5px 5px 0;
text-align: center;
color: #FFF;
}
#slide1 {
position: absolute;
width: 98%;
height: 20px;
margin: 0 5px 5px 0;
text-align: center;
color: #FFF;
}
there is also a wrapper which is 100% width
You fixed heights and widths in pixels. Change them to percentages.
Pixels doesn't scale down. A pixel is a pixel and percentage is the relative one.
So fix heights and widths in percentages
Related
I need the image to be sticked to left and occupy entire corner without taking spacing in top and bottom.Below is the CSS used for the chip and for the image inside chip.
.imgDiv{
display: inline-block;
padding: 0 25px;
height: 50px;
font-size: 16px;
line-height: 50px;
width: fit-content;
border-radius: 25px;
background-color: #f1f1f1;
}
.img {
float: left;
margin: 0 10px 0 -25px;
height: 50px;
width: 50px;
border-radius: 50%;
}
You can do it easily and purely with CSS flexbox:
.UserPill {
display: inline-flex;
align-items: center;
border-radius: 6em;
padding-right: 0.5em;
background-color: #f1f1f1;
font: 16px/1.6 sans-serif;
gap: 10px;
}
.UserPill-img {
height: 2.4em;
width: 2.4em;
object-fit: cover;
border-radius: 50%;
}
.UserPill-remove {
border: 0;
cursor: pointer;
background: transparent;
}
<div class="UserPill">
<img class="UserPill-img" src="https://picsum.photos/id/237/100/100">
<span class="UserPill-name">Chris Morris</span>
<button class="UserPill-remove" type="button" arial-label="Remove">✖</button>
</div>
<div class="UserPill">
<img class="UserPill-img" src="https://i.stack.imgur.com/qCWYU.jpg?s=328&g=1">
<span class="UserPill-name">Roko</span>
<button class="UserPill-remove" type="button" arial-label="Remove">✖</button>
</div>
<div class="UserPill">
<img class="UserPill-img" src="https://lh6.googleusercontent.com/-IdYKeLCNsyQ/AAAAAAAAAAI/AAAAAAAAAAA/AMZuucmgTYg8zk2oLDC9ZC0NM8sFu23r3g/s96-c/photo.jpg?sz=328">
<span class="UserPill-name">Anto Clinton</span>
<button class="UserPill-remove" type="button" arial-label="Remove">✖</button>
</div>
<div class="UserPill">
<img class="UserPill-img" src="https://i.stack.imgur.com/MGiQc.jpg?s=128&g=1">
<span class="UserPill-name">Amirreza Amini</span>
<button class="UserPill-remove" type="button" arial-label="Remove">✖</button>
</div>
I could get what you mean a bit. I think you want something like this. I don't know why you applied padding to .imgDiv, I deleted that. I think you applied it because of the width, use width instead.
.imgDiv {
display: inline-block;
/* EDITED HERE (USE WIDTH INSTEAD)
padding: 0 25px;*/
height: 50px;
font-size: 16px;
line-height: 50px;
/* RIGHT DOWN BELOW */
width: 200px;
border-radius: 25px;
background-color: #f1f1f1;
}
.img {
float: left;
/* EDITED HERE (DELETED)
margin: 0 10px 0 -25px; */
height: 50px;
width: 50px;
border-radius: 50%;
}
<div class='imgDiv'>
<img src='https://picsum.photos/200/300' class='img'>
<span>Chris Moris</span>
<span>✕</span>
</div>
Looking for improving my css skills, I created small site, the idea is to get best practice when creating responsive web sites. following simple HTML markup:
<section class="bg-image">
<img src="https://placehold.it/1606x1189" alt="imagem"/>
<div class="title">
<h2>I'm Title, <br />Sub Title</h2>
<button class="button-type-1">Click Me 1</button>
</div>
<div class="box">
<p class=".box-type-1">
There’s no magic pill you can take that will somehow attract rich people to your cause like moths to a flame.</p>
<p class=".box-type-2">
There’s no magic pill you can take that will somehow attract rich people to your cause like moths to a flame.</p>
<br />
<button class="button-type-2">Click Me 2</button>
<button class="button-type-3">Click Me 3</button>
</div>
</section>
I created in order to be responsive..
When I zoom in and zoom out, the title div and the box div, they just got off the viewport on different directions.
.image{
position: relative;
max-width: 100%;
height: 1189px;
width: 1606px;
opacity: 0.75;
}
.title h2 {
position: absolute;
color: rgb(37, 37, 78);
padding: 10px;
top:132px;
left:32%;
font-size: 80px;
letter-spacing: -0.1px;
line-height: 70px;
}
.title .button-type-1 {
position: absolute;
background-color: rgb(177, 166, 9);
height: 48px;
width: 265px;
border: 1px solid #FFFFFF;
border-radius: 34px;
left:43%;
top: 33%;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.1), 0 10px 20px 0 rgba(0,0,0,0.05);
}
.box {
position: absolute;
left:150px;
top: 550px;
height: 270px;
width: 60%;
left:23%;
border-radius: 4px;
background-color: #FFFFFF;
box-shadow: 0 0 30px 0 rgba(0,0,0,0.05), 0 4px 8px 0 rgba(0,0,0,0.08);
}
.box .box-type-1 {
height: 26px;
width: 315px;
color: #1E1C1A;
font-family: ".SF NS Display";
font-size: 25px;
line-height: 26px;
}
.box .box-type-2 {
height: 56px;
width: 1017px;
color: #535355;
font-family: ".SF NS Display";
font-size: 20px;
line-height: 28px;
text-align: center;
}
.button-type-2 {
height: 48px;
width: 224px;
border-radius: 34px;
background-color: #3d8b49;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.1), 0 10px 20px 0 rgba(0,0,0,0.05);
}
.button-type-3 { height: 48px; width: 209px; border-radius: 34px;
background-color: #B8455a;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.1), 0 10px 20px 0 rgba(0,0,0,0.05);
}
So how can I fix the issue when I zoom in the div tags content sticks to being responsive and not just go off the viewport.
What is the best practice I should be looking in when creating responsive app.
Use flexbox for making website responsive.here is the link
I am trying to achieve the box-shadow inside the right-border, currently everything is working fine except the shadow is getting display outside the right border. Following is the js-fiddle sample code I have tried...
http://jsfiddle.net/5y1guk6d/1/
HTML:
<div class="header">
<div class="header-bar">
<h1 class="title">Page title</h1>
</div>
</div>
<div class="main">
<div class="left-bar">
<div class="menu">
Menu Content
</div>
</div>
<div class="content">
Main content area
</div>
</div>
CSS:
.header {
width: 100%;
height: 40px;
top: 0;
color: white;
}
.header-bar {
height: 100%;
overflow: hidden;
background-color: #009BE1;
}
h1.title {
display: inline-block;
font: bold 16px Arial, sans-serif;
margin: 0 5px 0 15px;
position: relative;
top: 25%;
}
.main {
width: 100%;
overflow: hidden;
position: absolute;
top: 48px;
bottom: 0;
}
/* left bar */
.left-bar {
width: 160px;
float: left;
padding:10px;
background-color: #F0F0F0;
height: 100%;
position: relative;
border-right:1px solid #aaa;
box-shadow:5px 0 5px #ccc;
}
.content {
overflow: hidden;
left: 12px;
padding: 5px 17px 5px 5px;
height: 100%;
position: relative;
}
Appreciated your help..
If you want the box shadow to appear inside of the element instead of outside, use inset. Then you want to invert the x-offset so it appears on the right side.
box-shadow:inset -5px 0 5px #ccc;
http://jsfiddle.net/5y1guk6d/3/
i'm new to HTML & CSS and was hoping someone could help me out. I'm having a problem with this page where content is not fixed in place and when I zoom in and out the containers move freely. Any idea how to fix this? Not sure what layout I should be using to prevent this from happening. Thanks
<body>
<img class="img" src="http://i824.photobucket.com/albums/zz162/nathanial292/banner_zps45abd080.png">
<div id="header">
<h3 id="header h3">
Home Servers Shop Forum About Us Contact
</h3>
</div>
<div class="left">
<h1>Server Updates</h1>
<h2><span>Hello readers</span></h2>
</div>
<div class="right">
<a id="nabblelink" href="http://hydronetworks-forums.58422.x6.nabble.com/">HydroNetworks Forums</a>
<script src="http://hydronetworks-forums.58422.x6.nabble.com/embed/f1"></script>
</div>
<div id="footer">All Rights Reserved 2013 HydroNetwork</div>
</body>
#header{
z-index: 1;
border-radius: 5px;
height: 50px;
width: 600px;
background-color: #585858;
border: solid #383838 6px;
position: absolute;
margin-top: 25px;
margin-left:640px;
min-width: 480px;
}
.right{
z-index: 1;
border-radius: 5px;
height: 600px;
border: solid #383838 6px;
width: 400px;
background-color: #585858;
position: relative;
margin-top: 120px;
margin-right: 50px;
font-family: Ebrima;
overflow:auto
}
.left{
z-index: 1;
border-radius: 5px;
height: 600px;
border: solid #383838 6px;
width: 600px;
background-color: #585858;
position: relative;
margin-top: 120px;
margin-left:150px;
margin-right: 750px;
text-align: center;
font-family: Ebrima;
}
When you zoom in the content moves to the right and bottom, because you used pixel values.
At any rate you should remove
<body background= "http://i824.photobucket.com/albums/zz162/nathanial292/background_zps477e8756.png">
from your HTML-Code.
And add this to your CSS-Code:
body{
background: url(http://i824.photobucket.com/albums/zz162/nathanial292/background_zps477e8756.png);
background-position: top center;
}
If you don't want the divs to "move" when zooming, you should use percentages like width: 50%.
<html>
<head>
<title>Pixafy</title>
<style>
html {
background: url(wp.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='.wp.jpg', sizingMethod='scale');
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='wp.jpg', sizingMethod='scale')";
padding-top: 50px;
}
#ldiv {
vertical-align: top;
height: 120px;
width: 40%;
color:#ccc;
float: left;
position: relative;
border: 1px solid yellow;
}
#rdiv {
vertical-align: top;
float: left;
width: 40%;
border: 1px solid blue;
height: 120px;
}
#ctr {
vertical-align: middle;
width: 80%;
height: 150px;
border: 1px solid white;
background:url(mid.png) no-repeat center center;
}
#container1 {
vertical align: top;
width: 80%;
height: 300px;
border: 1px solid green;
background-color: #E3E3E3;
}
#container2 {
vertical align: top;
width: 80%;
height: 250px;
border: 1px solid green;
background-color: #000000;
}
#text1 {
align: left;
width: 80%;
color: #000000;
font-family: Arial, Vedana, Tahoma;
font-size: 24px;
font-weight: bold;
}
#space {
height: 25px;
border: 1px solid purple;
width: 80%;
}
ul {
list-style-type: none;
height: 80px;
width: 500px;
margin: auto;
}
li {
float: left;
}
ul a {
background-color: #29281E;
background-repeat: no-repeat;
background-position: right;
padding-right: 20px;
padding-left: 20px;
padding-top: 6px;
padding-bottom: 6px;
display: block;
line-height: 22px;
text-decoration: none;
font-weight: bold;
font-family: Verdana, "Times New Roman", Times, serif;
font-size: 14px;
color: #D6D7D8;
}
.clear-both {
clear: both;
}
#text2 {
width: 70%;
border: 1px solid #00CCFF;
color: #000000;
font-size: 16px;
font-family: Arial, Verdana, Tahoma;
font-weight: bold;
}
#btn {
width 10%;
border: 1px solid #FFCC00;
vertical-align:bottom;
}
.btnlearn {
clear:both;
width:125px;
height:40px;
background:#E55D22;
text-align:center;
line-height:40px;
color:#FFFFFF;
font-size:12px;
font-weight:bold;
cursor: pointer;
}
.btnlearn:hover {
text-decoration: underline;
cursor: pointer;
}
#rcw {
width: 80%;
color: #BAB8B8;
font-size: 18px;
font-size: Arial, Verdana, Tahoma;
}
#left
{
width: 33%;
float: left;
border: 1px solid yellow;
display: inline-block;
height: 250px;
}
#right
{
width: 33%;
float: left;
border: 1px solid white;
display: inline-block;
height: 250px;
}
#mid
{
width:33%;
float: left;
border: 1px solid red;
display: inline-block;
height: 250px;
}
</style>
</head>
<body>
<div width=100% style="margin: 0 auto;">
<div id="ldiv"><img src="pixafy.png" style="position: absolute; left: 0px;" /></div>
<div id="rdiv">
<ul>
<li>Home</li>
<li>Services</li>
<li>Works</li>
<li>Blog</li>
<li>Contact</li>
</ul>
</div>
<div class="clear-both"></div>
<div id="ctr"></div>
<div class="clear-both"></div>
<div id="space"></div>
<div class="clear-both"></div>
<div id="container1" style="position: relative;">
<div id="text1" style="position: absolute; left: 25px; top: 15px;">We are a company of experts developer based in New York City.<br>Partner with us to achieve your business goals through technology.</div>
<div class="clear-both"></div>
<div id="text2" style="position: absolute; left: 25px; top: 85px; overflow: auto">Our talented and experienced team has over 10 years of experience developing world-class websites and applications, and we leverage the latest technologies, content management solutions, open source platforms and web standards to solve any challenge.</div>
<div id="btn" style="position: absolute; right: 45px; top: 100px;"><input type=button class=btnlearn value="Learn More" /></div>
<div class="clear-both"></div>
<div id="rcw" style="position: absolute; left: 25px; top: 175px;">Recent Work</div>
<img src="1.png" style="position: absolute; left: 150px; bottom: 0px;" />
<img src="2.png" style="position: absolute; left: 400px; bottom: 0px;" />
<img src="3.png" style="position: absolute; left: 650px; bottom: 0px;" />
</div>
<div class="clear-both"></div>
<div id="container2" style="position: relative;">
<div id=left stlye="position: absolute;">
<span style="position: relative; top: 25px; left: 25px; color: #FFFFFF; font-size: 19px; font-weight: bold;">Website Development</span>
<div class="clear-both"></div>
<img src="wd.png" style="position: relative; left: 25px; top: 40px;" />
<span style="position: relative; width: 25%; top: 40px; left: 80px; color: #ffffff; border: 1px solid green;">Custom websites and easy-to-use content management solutions that are scalable, robust and cross browser compatible. Our team has knowledge and experience in all web technologies.</span>
</div>
<div id=right stlye="position: absolute;">
<span style="position: relative; top: 25px; left: 25px; color: #FFFFFF; font-size: 19px; font-weight: bold;">eCommerce Solutions</span>
</div>
<div id=mid stlye="position: absolute;">
<span style="position: relative; top: 25px; left: 25px; color: #FFFFFF; font-size: 17px; font-weight: bold;">Mobile Phone Applications</span>
</div>
</div>
</div>
</body>
</html>
Outpost
I want to wrap it so I can have the similar contents in the next two DIV as well.
Not sure why is there a tab on the first line and giving me this issue.
Can someone tell me why is it going over to the next DIV?
Please help me resolve this issue.
I would like to make it look like this:
I'm giving you an answer but request you to learn about Semantic HTML and CSS Positioning. That'd help you out a lot.
Now, as far as this example is concerned, you're over-using CSS Positioning. KISS principle states that the html should be very simple and easy to style. Yours is but is not semantic. I've made it semantic and have then added correct styles to mimic what you want.
New screenshot:
JS Fiddle Demo: http://jsfiddle.net/q9Rvq/3/
Added CSS:
#container2 > div h5{
text-align:center;
margin:5px 0px;
}
#container2 > div img{
float:left;
margin-left:20px;
}
#container2 > div p{
margin-left:55px;
margin-right:10px;
margin-top:0px;
width:auto;
}
Edited HTML:
<div id="container2" style="position: relative;">
<div id=left stlye="">
<h5 style="color: #FFFFFF; font-size: 19px; font-weight: bold;">Website Development</h5>
<div class="clear-both"></div>
<img src="wd.png" style="" />
<p style="color: #ffffff; border: 1px solid green;">Custom websites and easy-to-use content management solutions that are scalable, robust and cross browser compatible. Our team has knowledge and experience in all web technologies.</p>
<span style="position: relative; bottom: 0px; right: 15px;">Learn More</span>
</div>
<div id=right stlye="">
<h5 style="color: #FFFFFF; font-size: 19px; font-weight: bold;">eCommerce Solutions</h5>
<div class="clear-both"></div>
<img src="wd.png" style="" />
<p style="color: #ffffff; border: 1px solid green;">Our team will collaborate with you to understand your online objectives and goals, using that information to build a secure and reliable web-based storefront.</p>
<span style="position: relative; bottom: 0px; right: 15px;">Learn More</span>
</div>
<div id=mid stlye="">
<h5 style="color: #FFFFFF; font-size: 17px; font-weight: bold;">Mobile Phone Applications</h5>
<div class="clear-both"></div>
<img src="wd.png" style="" />
<p style="color: #ffffff; border: 1px solid green;">Our team specializes in developing mobile applications and websites that deliver on quantity, performance and speed.</p>
<span style="position: relative; bottom: 0px; right: 15px;">Learn More</span>
</div>
</div>
The content is overflowing because the element is relatively positioned. As some people have commented you should try not to use too much positioning as it will hinder you from creating layouts that reflow. You could also apply a width to the element to wrap the text.
The HTML for the picture you show should look like this:
<div>
<h3>eCommerce Solutions</h3>
<img alt="" src="">
<p>Our team will...</p>
Learn More
</div>
Css could look like this:
div {
width: 300px;
height: 200px;
background-color: #000;
color: #fff;
padding: 20px;
}
div img {
float: left;
margin: 0 10px 10px 0;
}
div a {
float: right;
}
Fiddle: http://jsfiddle.net/LM5MZ/3/
In this jsFiddle (don't mind the broken images...) I've only made a slight tweak to the style attribute of the <span/> tag holding the text which is overflowing. I replaced position: relative; width: 25%; top: 40px; with margin: 40px 5px 5px 80px;display: inline-block; The display: inline-block tells the browser to render the element with a box model which is required for the margin: 40px 5px 5px 80px attribute to be respected. This keeps the content within its containing parent <div/> tag.
However, it's still overflowing the bottom, probably because of the absolute positioning. If you wanted it to scroll, you could apply overflow: auto to that <div/> but I don't think that's the look you're going for.
This is the span tag you have which is holding the text that is bleeding over:
<span style="position:relative;width: 25%; top: 40px; left: 80px; color: #ffffff; border: 1px solid green;">
The div, called #left, has a style which sets
width:33%
so it is a fixed width. the "left:80px" in your span style is forcing the text outside of the fixed width left div. So, just move it to the right, try left: 0px instead.
The problem is the misuse of position. It's better in this case to use padding.
Here is some tidy html taking use of css, padding and a little floating:
HTML
<div id="BoxContainers">
<div class="boxes left">
<div class="innerBox">
<div class="title">Website Development</div>
<img src="wd.png" alt="" />
<div class="content">
<p>Custom websites and easy-to-use content management solutions that are scalable, robust and cross browser compatible. Our team has knowledge and experience in all web technologies.</p>
Learn More
</div>
</div>
</div>
<div class="boxes right">
<div class="innerBox">
<div class="title">eCommerce Solutions</div>
<img src="wd.png" alt="" />
<div class="content">
<p>Our team will collaborate with you to understand your online objectives and goals, using that information to build a secure and reliable web-based storefront.</p>
Learn More
</div>
</div>
</div>
<div class="boxes centre">
<div class="innerBox">
<div class="title">Mobile Phone Applications</div>
<img src="wd.png" alt="" />
<div class="content">
<p>Our team specializes in developing mobile applications and websites that deliver on quantity, performance and speed.</p>
Learn More
</div>
</div>
</div>
</div>
CSS
#BoxContainers {
height: 250px;
border: 1px solid green;
color: #ffffff;
background: #000000;
position: relative;
}
.boxes {
width: 33%;
float: left;
height: 250px;
}
.boxes.left {
border: 1px solid yellow;
}
.boxes.right {
border: 1px solid white;
}
.boxes.mid {
border: 1px solid red;
}
.boxes .innerBox {
padding: 25px;
}
.boxes .title {
font-size: 19px;
font-weight: bold;
margin-bottom: 10px;
}
.boxes img {
float: left;
}
.boxes .content {
padding-left: 55px;
}
.boxes .content p {
margin-top: 0;
}
Demo
Take note, there is no inline styling. Avoid using inline styling, even for mocking something up quickly. If you are using css properly, it will be quicker putting your css in a stylesheet and using classes to reuse your styles.