Need to fix an image to a specific spot on a page - html

I need to fix a .gif image to a specific spot on my home page. I've placed the image in my HTML, and "position:fixed" doesn't do what I want - the rest of the page's content scrolls beneath the image. I want the image to stay in the same place at all times.
Disclaimer: I know next to nothing about HTML & CSS, so my apologies if this is a very simple question. I've done research, but nothing I've tried seems to work.
On a related note, my image changes size depending on what browser I'm viewing my site in. I read here in answer to another question that you can remedy that by using percentages instead of pixels to format your object, but I tried that and the problem remains.
Other notes: I use Chrome as my browser and am building my site using Weebly. My website address is http://www.designartistree.com/ and the image in question the ribbon in the middle of the page beneath the large "Design Artistree" logo.
Any beginner-friendly advice would be greatly appreciated! Thank you!
Here's the html code that I have for the image:
<img src="/files/theme/ribbon.gif" alt="ribbon" style="position:fixed; margin-left:27.6%; margin-top:61%; width:63.7%; height:10%; z-index:50; visibility:show">

If you use position:fixed, the element is positioned relatively to the window, so even if you scroll, the element doesn't move.
If you want it to move when you scroll, use position:absolute.
But because of your layout, you have 2 options:
Place the image inside #box
Remove the following code:
html{
overflow:hidden;
height: 100%;
max-height: 100%;
}
body {
height: 100%;
max-height: 100%;
width: 100%;
}
#box {
height: 100%;
max-height: 100%;
overflow: auto;
width: 100%;
}

Related

How to make an image crop and re-center as browser width changes

I have a custom widget area with the Visual Editor plugin setup so I can do promotions or whatever in the header area.
I have CSS classes for this widget. They control the background img, etc.
My boss told me he wanted the images responsive, but as it turned out what he actually meant is he would like them to crop and re-center as the width of the browser changes. Like in this video home page slider cropping/re-centering, that's taken from the home page.
My header area widget can be seen here - 100daysofrealfood.com/carrot-almond-recipe
As you shrink down the browser, you see the image re-sizes itself appropriately. However, my boss would like it to stay relatively largish so you can still read the text (hence the cropping) but re-center as well.
I inspected the home page and I can see it's a media query that's controlling this, so I tried to use those same things in the .responsive-image I setup in my CSS -
.responsive-image {
width: auto;
max-width: none;
height: 100%;
position: relative;
transition:all .2s ease;
}
This is the code I have in the tester widget I'm doing that's hidden on a private page -
<a href="https://www.100daysofrealfood.com/spring-reset-real-food-mini-pledge-
program/?utm_source=headerwidget"><div class="responsive-image"><div
class="days100-background-header-widget days100-background-header-widget-
image-background"></div></div></a>
And it's just displaying the image totally uncropped. I can't share a link to this because I don't have enough reputation points.
So my question is - how do I accomplish within the div of the widget what's happening on the front page. Is this possible? I tried to do a div-class with the img settings used in the slider and that didn't work either. All of the CSS for this is going in the additional CSS area of the home page so I can't do anything that will impact that. I hope this makes sense! I really appreciate any help/tips/etc. Also please let me know if I need to show any other code snippets.
The thing that you're looking for is background-image.
What you need to do is to use the image as a background inside a container. Then adjust your element via css.
It would look something like :
div.image-background{
position: relative;
background: url('') top center no-repeat;
background-size: cover;
width: 100%;
height: 200px;
}
You adjust the rest as it suits your work.
References:
How TO - Full Page Image
Perfect Full Page Background Image
Using percentage on height/width alone would force the other to stay at proportion and would make it resposive to the browser's width.
example:
.responsive-image {
width: 30%;
position: relative;
transition:all .2s ease;
}
I hope I got your question correclty but if I did this should do.

HTML/CSS: How to make a <div> containing an <img> tag inside a <section> responsive?

I'm making a website using fullPage.js, On the second page (or equivalently, second section) I want to achieve a very simple layout where I have a header fixed on top of the page displaying an image which should be responsive, or decreases in size as the window shrinks but stays at the top.
Currently, I'm wrapping the image to be displayed in a div. I then scale the div fullscreen using,
.post-header {
background: #22BDA0;
max-width: 100%;
height: auto;
}
The img tag inside of the div has a class header-image which I style as,
.post-header .header-image {
max-width: 100%;
height: auto;
margin: 0;
}
However, I'm not getting the desired result. There is a small space on top of the second page which I can't get rid of. You can see the website I'm making along with the source code HERE. Just scroll down to second page, or click Personal Details on the homepage.
Thanks a lot for the help!
What if you just give height:100%; to .section2-container? Will it solve your issue?
Remove display: table-cell; from .fp-tableCell and the padding disappears. Does this need to have display set to table-cell?
fullPage.js has an option: verticalCentered that can be set to false. This seems like a good solution, since the alternative means always trying to ensure that the content of the containing element is always 100%.

Website container won't align to the centre (Mobile and web)

Hoping that the community will be able to help me out here as I really am stuck. I've having 3 I issues with my website:
Website Link
For some odd reason - I can't get my columns to line up straight. The entire page seems to be more to the right than in the centre on both desktop and mobile
What I'm trying to do with the top image is have it take up the entire page upon loading, and then as you scroll, the image disappears. For some reason, on mobile, the image doesn't cut off and allows for the user to scroll to the right.
On mobile, I can't get the top image to show properly. It stretches vertically, and users have to scroll all the way past the photo to get to my content... I want the main image to resize like it does on a desktop browser and only take up the screen real estate when the page loads
Any advice here would be helpful...
In your projects sections - if that is where your issue is has padding on a UL tag - which is causing it to look misaligned.
You could do this to fix that section:
ul.skillssection {
padding-left: 0;
}
It'll be more helpful for the community if you made points or set up a jsfiddle.
Update - answer for number 2.
I can't seem to replicate it but I've noticed you've got:
img.bg {
min-height: 100%;
width: 100%;
min-width: 780px;
overflow: hidden;
}
I would change it to:
img.bg {
min-height: 100%;
max-width: 100%;
overflow: hidden;
}
So the max-width is always 100% and it should follow the width of the parent.

How do I specify my image's position?

I have a problem with my web site position, this is my CSS:
My web site: http://jsfiddle.net/maxspeed200/qYCUJ/5/embedded/result/
My CSS: http://jsfiddle.net/maxspeed200/qYCUJ/6/
The problem is: I have this two images one in header and the second in content & jquery slide show all this elements work good and I modified their position on my computer BUT when I take my website index to another computer all images move left or right (Pushed from its place)
And I work in my Dreamweaver in split view I create my design n n set my images in their places when I go to view my web site in browser (Mozilla/IE) I see my images not in same places I know it is a problem in CSS but how do I modify it?
If there in an absolute position element so give his parent position relative now give position: relative; to .container DIV. like this:
.container {
background-color: #CCCCCC;
height: 800px;
margin: auto;
position: relative;
width: 700px;
}

Text overextending past footer DIV tag

I've been having problems with my DIV layers - the text goes beyond the DIV footer image, but it's not entirely the DIV background's fault 'cause it DOES repeat... Up to a certain extent. :( I can't seem to figure out how to force the text to stop overextending past the footer DIV tag WHILE keeping the DIV background going.
My "container" element houses the images and the other two elements. The "main" element is where the text goes, and the "footer" element is the image that comes after the end of the text.
In this image here, the text goes over the footer image - green arrow is to show where the footer image starts, red arrow is to show where I'd like the text to stop. The background image in the container works for awhile but then stops, so I suppose it doesn't expand correctly...??
I tried to play around with the code to try and fix it - from trying to add padding-top/bottom, to adding the repeating background stretch in the body part, to playing around with the position properties, to trying out the sticky footer (except my layout is only one column... the navigation is part of the layout in the CSS), I just can't seem to get it right.
This is as best as I can get it. :( Do you guys have any helpful solutions and/or tips?? Thanks so much!
Link: http://bubble-wrapped.net
#container {
position: absolute;
width:1057px;
height: 100%;
background-image:url(layout/bw-div.png);
background-repeat: repeat-y;
border:0px;
text-align:left;
padding-bottom:50px;
}
#main {
position: absolute;
top: 256px;
left: 126px;
width: 830px;
margin: auto;
}
#footer {
height: 358px;
width: 1057px;
bottom: 0;
position: static;
background: url(layout/bw-footer.png) no-repeat;
}
It looks like you've set the footer to a set height, which is why the text is overflowing.
If you're find with cut-off text, try adding a CSS property to the footer: overflow:hidden or overflow:scroll.
If you don't want overflow, then try removing the height property from the footer or setting it to height:auto or something similar.
Has to do with position: tag & height: tag
I suspect it has to do with the element within the container and not just the container.
It would help if you would post most of your code so we can see if other things break it.
Your question doesn't really say what your looking to do, which doesn't help us help you.
If its anything like Possible same situation & answer #StackOverFlow
Hope this helps you!