As the title says, I'd like the "background" element to fit the side of the screen (you can see it doesn't go all the way to the right), as well as to go all the way to the bottom of the screen. Can anyone help?
The code can be seen here: codepen
(specifically these elements)
```
.background {
background: url("https://static.kent.ac.uk/nexus/ems/50.jpg");
border: 3px solid black;
margin: 0 auto;
}
.text {
margin: 0 30px 0 30px;
background-color: #ffffff;
border: 1px solid black;
opacity: 0.6;
height: auto;
}
.text p {
margin: 5%;
font-weight: bold;
color: #000000;
opacity: 1;
}
```
Setting margin: -20px; on the <header> pulls it out of the page, and with that creating the horizontal scroll bar, by removing the margin: -20px; the header will be placed fully in the document and the scrollbar will disappear.
codepen
Setting margin and padding to 0, then setting background width to 100% seemed to do the trick. Is this the desired result?
* {
margin: 0px;
padding: 0px;
}
.background {
background: url("https://static.kent.ac.uk/nexus/ems/50.jpg");
border: 3px solid black;
margin: 0 auto;
width: 100%;
}
.text {
margin: 0 30px 0 30px;
background-color: #ffffff;
border: 1px solid black;
opacity: 0.6;
height: auto;
}
.text p {
margin: 5%;
font-weight: bold;
color: #000000;
opacity: 1;
}
It's happening because you gave border: 3px solid black; in your background class that's why it is not showing correctly.
If you want to use border at top and bottom then you can do like this
.background {
background: url("https://static.kent.ac.uk/nexus/ems/50.jpg");
border-top: 3px solid black;
border-bottom: 3px solid black;
margin: 0 auto;
width: 100%;
}
So the conclusion is you have to remove the border from left and right after then you can get the result you want.
Here you can see difference Codepan
Hope this will helps you
Related
I'm trying to create a text box mixture of HTML/CSS. I have CSS code for designing of text box. I want to use this code in blogger but I'm unable to combine the CSS in one class so that use in blogger. Someone help me please. Thanks.
CSS and HTML:
body {
background-color: #f1f1f1;
font-family: Helvetica,Arial,Verdana;
}
.link-box,.link-wrapper {
position: relative;
padding: 10px;
}
.link-wrapper {
width: 500px;
margin: auto;
margin-top: 50px;
}
.link-box {
width: 80%;
border: 1px solid #ccc;
outline: 0;
border-radius: 15px;
}
.link-box:focus {
box-shadow: 0 0 15px 5px #b0e0ee;
border: 1px solid #0AA700;
}
<div class="link-wrapper">
<input type="text" onClick="this.select();" name="focus" required class="link-box" value="www.google.com" readonly/>
</div>
Not entirely what you mean by one class. But if you mean you can only have a class on the parent div and not on the input, this would work.
.link-wrapper {
position: relative;
width: 500px;
margin: auto;
margin-top: 50px;
padding: 10px;
}
.link-wrapper input {
width: 80%;
border: 1px solid #ccc;
outline: 0;
border-radius: 15px;
padding: 10px;
}
.link-wrapper input:focus {
box-shadow: 0 0 15px 5px #b0e0ee;
border: 1px solid #0AA700;
}
Is there a way to create a trapezoid shadow effect underneath a image such as the one in the image?
I only know create trapezoid with border. What i've came up with so far is this:
HTML
<div id="trapezoid"></div>
CSS
#trapezoid {
height: 0;
width: 120px;
border-bottom: 80px solid #05ed08;
border-left: 45px solid transparent;
border-right: 45px solid transparent;
padding: 0 8px 0 0;
}
Thanks in advance.
I've created a jsFiddle that demonstrates a way to do it. In essence: give the image a shadow, overlay a transparent div on it that hides left, top and right border of the shadow. Because of these white borders this trick will not work if you use a complex background.
.wrapper {
display: inline-block;
position: relative;
overflow: hidden;
margin: 0;
padding: 0;
font-size: 0;
}
.wrapper img {
box-shadow: 0 0 50px black;
margin: 0px 30px 50px 30px;
}
.wrapper .overlay {
position: absolute;
left: 0;
top: 0;
display: inline-block;
width: 100%;
height: 100%;
border-top: 0px solid white;
border-left: 30px solid white;
border-right: 30px solid white;
border-bottom: 50px solid transparent;
box-sizing: border-box;
}
<div class="wrapper">
<img src="http://i.stack.imgur.com/eg2RH.jpg" width="400" />
<div class="overlay"></div>
</div>
As you can see, when the div expands I have no option to scroll down and I'm wondering how I would go about fixing this. Here is my css
<style>
#cust_info {
width: 300px;
min-height:350px;
margin: 0 auto;
padding: 1em;
background-color: #fff;
border-radius: 25px;
border: 2px solid #66CCFF;
padding: 20px;
position: fixed;
top: 100px;
left: 40px;
font-family: arial;
}
.more {
display: none;
border-top: 1px solid #fff;
border-bottom: 1px solid #fff; }
a.showLink, a.hideLink {
text-decoration: none;
color: #36f;
padding-left: 8px;
background: transparent url(down.gif) no-repeat left; }
a.hideLink {
background: transparent url(up.gif) no-repeat left; }
a.showLink:hover, a.hideLink:hover {
border-bottom: 1px dotted #36f; }
</style>
I gave the div a min height so it would expand without text leaving the area, but when the div expands past the screen I lose most of the div.
Please remove position:fixed from #cust_info id.
Removing that will automatically give a scroll in your page.
For keeping it left align, just give float:left to #cust_info.
I have a header photo, and usually they are fairly easy to set up. However, for some reason which I cannot find, the header image floats over the elements of the HTML page.
Any help would be appreciated. I have tried looking for any margins/padding I forgot to delete, but there are none.
Picture of problem...
HTML pertaining to header image:
<div id="gallery">
<div id="imgContain">
<img src="pictures/clubhouse.jpg">
</div>
</div>
My CSS File: (not sure where the problem is, so I posted all of it...)
html, body
{
margin: 0;
padding: 0;
background-attachment: fixed;
background-image: url('.././pictures/04.jpg');
background-color: rgb(56,32,32);
}
#font-face
{
font-family: fancyFont;
src: url('fonts/fancy.otf');
}
#wrapper
{
min-width: 1000px;
margin: auto;
}
#content
{
background-color: white;
display: table;
border-radius: 5px;
bottom: 0px;
left: 0;
margin: auto;
right: 0;
top: 0;
width: 915px;
height: 100%;
box-shadow: 5px 5px 22px black;
}
#content p
{
padding: 25px;
font-family: Arial;
text-indent: 30px;
font-size: 1em;
word-wrap: break-word;
}
center
{
border-bottom: 1px solid black;
}
table
{
border: 1px solid black;
float: left;
}
.main-table /*Main table is the navigation table to the left...*/
{
background-color: white;
margin-bottom: 25px;
border: 4px double white;
width: 245px;
box-shadow: 0px 0px 10px black;
}
.main-table td
{
padding: 10px;
padding-left: 15px;
}
.main-table td a
{
text-decoration: none;
color: black;
font-family: Arial;
transition: .2s;
font-size: .9em;
padding-left: 20px;
}
.main-table td a:hover
{
border-bottom: 1px solid black;
color: black;
padding-left: 50px;
transition: .2s;
}
.main-table h1
{
font-family: fancyFont;
padding:10px;
color: black;
text-shadow: 2px 2px 1px white;
}
.division /*Division(s) are the small info boxes in the center.*/
{
margin-top: px;
margin-left: 40px;
border: none;
margin-bottom: 0px;
}
.division th
{
width: 250px;
background-color: white;
border-bottom: 3px double black;
padding: 10px;
font-family: fancyFont;
}
.division tr td
{
display: inline-block;
width: 250px;
height: 100px;
max-width: 250px;
}
#gallery
{
width: 100%;
height: 100px;
}
#gallery h1
{
font-family: fancyFont;
text-shadow: 2px 2px 1px #acacac;
}
#gallery img
{
width: 100%;
height: 450px;
border-bottom: 1px solid black;
}
table ul li
{
list-style: square;
font-family: Arial;
}
#imgContain
{
background-color: white;
width: 100%;
margin: 0;
padding: 0;
}
#table-container
{
width: 900px;
margin: 0;
}
take out the
#gallery{height:100px;}
css because your gallery img height is 450px and the two conflict.
An element will "float" over another element when the floating element's position is set to absolute. I don't see position: absolute; in your CSS, but I do see positioning styles (bottom: 0px; left: 0; etc.) so maybe another style sheet is applying position: absolute. Best way would be to inspect the elements using a browser inspector like Firefox has and see what CSS styles are being applied. You can send me the URL and I will look at it. If you just want to throw a dart at the board you could try setting this style:
#gallery {
position: static !important;
}
Floating generally happens when position: absolute is set in CSS, but strangely, it's not your case.
So, you can try to add a CSS property to this image, called z-index with the value of -1. It'll possibly work.
This property is a kind of "layers". By default, every element is set in z-index: 0.
So, basically, it'll be:
img {
z-index: -1;
}
or, in this case:
#gallery {
z-index: -1;
}
Sorry if my english is bad.
I want div 2 to stay fixed to the top of the screen when the browser scroll reaches the navigation bar. How would i do this ?
My current styles probably suck as im still learning from google but here they are:
/*main wrapper*/
#main {
width: 90%;
height: auto;
margin-left:auto;
margin-right:auto;
}
/*logo start*/
#logo {
background-color: #e6e6e6;
position: relative;
padding: 2px;
margin: 0px;
border: 3px solid #000000;
border-radius: 25px 25px 0px 0px;
height: 174px;
width: 100%;
}
/*navigation bar start*/
#nav-outer {
position: relative;
width: 100%;
margin-bottom: 40px;
}
#nav-box {
width: auto;
display: inline-block;
position: absolute;
top: -3px;
padding-left: 15px;
background-color: #e6e6e6;
border-left: 3px solid #000000;
border-right: 3px solid #000000;
border-bottom: 3px solid #000000;
border-radius: 0px 0px 15px 15px;
text-align: left;
}
For an easy solution, there is this jQuery plugin:
http://stickyjs.com
And a tutorial for it:
http://www.websitecodetutorials.com/code/jquery-plugins/sticky-js-position-fixed-at-certain-point-in-page.php
Because this is such a common issue, there is also a new CSS position value called sticky which will do exactly what you want. If you're interested in that then there's a great article about it here:
http://updates.html5rocks.com/2012/08/Stick-your-landings-position-sticky-lands-in-WebKit
Ok, set the position then to:
#nav-box {
position: fixed;
..
..