How to do two rows inside of a Hero-Unit without responsive? - html

I'm doing a web on Bootstrap and I'm getting into some serious troubles that I can't solve even with Bootstrap documentations. So, this is my code:
<div class="container">
<div class="hero-unit">
<h2>Two Rows</h2>
<div class="row">
<div class="span6">
<center>
<img src="../img/renders/example.png" style="position: absolute; width: 200px; height= 200px; margin-top: 80px">
<img src="../img/covers/some_image.jpg" title="Image title" class="img-rounded propiedades_imagenes">
</center>
</div>
</div>
<div class="span6">
<div class="well" style="margin-top:130px">
<a class="btn btn-large btn-primary" href="#link">
<i class="icon-download"></i> Download</a>
<a class="btn btn-large btn-inverse" href="#random.html" style="margin-left:272px">
<i class="icon-random icon-white"></i></a>
</div>
</div>
</div>
I'm trying to create two rows inside of a Hero-Unit, the thing is it worked when I had the responsive design activated but when I activate it the page just do some crazy stuff with the design in smaller and bigger screens than mine, so I just deleted the link to bootstrap-responsive.css and I put a "class=row" instead of "class=row-fluid", but now it just creates one row instead of two and put all the content of the second row under the first one.
Am I doing something wrong? I know how to do this with responsive, but it messes up all my work.
Image of what I want and what I get with the responsive design: http://i1129.photobucket.com/albums/m518/ZoxSoft/Capturadepantalla2013-08-13alas000037_zps064f71b1.png

I am not familiar with Bootstrap or Hero-unit
but I think that you need another Div with class="row"
it is hard to troubleshoot with out a visual of what is going on and what it is supposed to be doing. but first glance to me says you need another div tag with the class of row.
you have 3 </div> at the end of the code snippet that you gave and only 2 that need to be closed?
NEW
in your first image link it looks like you have a lot of styling but no Title Attribute and no Class Attribute
with out that class attribute your responsive and Hero-Unit won't know to grab it

So I finally figured it out. I created two new classes for each div, one for the left one and another for the right one, I put this code into de first one:
width: 50%;
float:left;
And for the right one:
width: 50%;
float:right;
After that, did a few changes in the margin of the objects to fit in the page and finally got it!

Related

How to resize and crop an image with CSS, inside a Bootstrap Card?

Following problem: I have some Bootstrap card elements with pictures, and some pictures have different sizes/ratios, like the one in the middle (see attached screenshot). Therefore my card elements are not in one row. That's not very nice.
Now I would like to resize these images to the height of the others, and crop the overflow. How do i do that? Heres my code snippet of one card...
<div id="cities">
<div class="city">
<div class="card">
<div class="city-img-container">
<img class="card-img-top city-img" src="..." alt="New York City">
</div>
<div class="card-body">
<h5 class="card-title"><b>Name: </b>New York City</h5>
<p class="card-text"><b>Land: </b>USA<br>
<b>Spitzname: </b>The Big Apple</p>
<div class="city-bottom-content">
<a href="#/city?id=35" class="btn btn-primary" data-id="35">
<i class="bi bi-arrow-right"></i>
</a>
<button data-id="35" class="is-favorite">
<i class="bi bi-heart-fill"></i>
</button>
</div>
</div>
</div>
<div class="city">
...
</div>
</div>
PS: The card elements inside of #cities are arranged with grid and grid-template-columns.
Thank uuu! :)
screenshot
You can make all of the images the same height (and width) by using object-fit.
.card-img-top {
width: 100%;
height: 15vw;
object-fit: cover;
}
In the example above, the height of all images will be 15% of the viewport width. This could be whatever you please...500px, 10vh, etc.
The object-fit: cover;, will likely hide parts of images - but perhaps you could implement a means of viewing them in full-size when clicked on? Either way, it's a nice approach to keep the cards fairly uniform.
Note that you are just making some adjustments to the existing Bootstrap class .card-img-top. You could include this CSS on your HTML file, in your CSS file, or update the class in your Bootstrap file if you downloaded it.
Give a fixed height to image tag so small images will automatically expand.
<img class="card-img-top city-img" height="200px" src="..." alt="New York City">

Div not creating a block and not priventing from inside things go inside of him

For some reason my code doesn't give the highest div its own area and all of the other parts of the website are overlapping into the first div, what did I do wrong?
Website
<div class="container-fluid" id="background-body">
<div class="row div-border container4" style="background-color:dimgrey;">
<div class="col-md-9 ">
<h1 class="title" style="font-size:40px;">Computer science student ,trying to learn Front-End develpoing and expand my knowledge on all relative subject to computers,mostly interested in coding<br>-----------------------------------------------------<br>C -- C++ -- Front-End Beginner </h1>
</div>
<div class="col-md-3 center">
<img style="border-radius:50%; width:85%; " alt="My Picture" src="https://thumb.ibb.co/min1tH/17127255_1810602309157311_608558868267532288_a.jpg" >
</div>
</div>
<h2 style="text-align:center;"><u>My Finished Projects</u>:</h2>
well i just made the div with a static height for now until i can find a better solution
You opened 3 times div than you close 1 time and open another one and close 2 again, I think just forgot to close one div
so add another </div>
In your CSS, your div.container4 class has a fixed height:
div.container4 {
height: 10em;
}
If you remove it, the container divs grow with the content.

Button not clickable when top position adjusted

For some reason, when i add the 'top: xxx' property in css my button becomes unclickable, and i cant position it correctly. It was working fine before. I have it set up to run joyride onclick, which is a foundation plug in. Not sure whats going on. Here's my html, and link to the site, please inspect element to see code www.omegadesignla.com:
<div class="container">
<header>
<div class="row">
<div class="large-3 small-centered columns"> <!-- large centered -->
<a id="topbutton" class="button large radius button">Take the tour!</a>
</div>
</header>
Here is my css:
#topbutton{
position: relative;
top: 125px;
}
your just missing an href attribute inside the
try this
<a id="topbutton" href="#" class="button large radius button">Take the tour!</a>

Strange div positioning

I received HTML & CSS layout that should be working fine. However, I'm experiencing some strange problems for which I'm not sure why do they occur.
At the bottom of the following this website there is slider that should display couple of photos with text and by clicking on arrows it should slide them. The problem is I can't position neither arrows, nor wrapper containing images.
As you can see arrows(CSS classes: .strelica-lijevo and .strelica-desno are currently behind the image wrapper (CSS class: .slike-wrapper) when they should be left (.strelica-lijevo) or right (.strelica-desno).
Code can be seen directly on the website. Any help would be appreciated.
There are some issues with the HTML and CSS - you should either try to contact whoever delivered this slider to get support for implementing it or you could try by yourself as follows (just checked the markup and CSS and maybe this helps):
Your current HTML:
<div class="w-clearfix main-content karta">
<div class="slike-wrapper">
<a class="w-inline-block featured-male-slike karta" href="/zagreb/category/to-see/2/zagreb-is-the-capital-and-the-largest-city-of-croatia/5">
<img class="featured-male-slike" src='/Content/610ddd4a-b9a7-45f8-ac56-66eec5968329.jpg' />
<div class="potpis-mala-slika-featured">
<div class="potpis-ispod-slike">Zagreb is the capital and the largest city of Croatia</div>
</div>
</a>
<a class="w-inline-block featured-male-slike karta" href="/zagreb/category/to-see/2/museum-of-broken-relationships/8">
<img class="featured-male-slike" src='/Content/3a6ee262-676f-4599-9f97-6b9c48136449.jpg' />
<div class="potpis-mala-slika-featured">
<div class="potpis-ispod-slike">Museum of Broken Relationships</div>
</div>
</a>
</div>
<div class="strelica-lijevo"> <img src='/Content/strelica-lijevo.svg' /> </div>
<div class="strelica-desno"> <img src='/Content/strelica-desno.svg' /> </div>
</div>
could be changed into:
<div class="w-clearfix main-content karta">
<div class="strelica-lijevo"> <img src='/Content/strelica-lijevo.svg' /> </div>
<div class="slike-wrapper">
<a class="w-inline-block featured-male-slike karta" href="/zagreb/category/to-see/2/zagreb-is-the-capital-and-the-largest-city-of-croatia/5">
<img class="featured-male-slike" src='/Content/610ddd4a-b9a7-45f8-ac56-66eec5968329.jpg' />
<div class="potpis-mala-slika-featured">
<div class="potpis-ispod-slike">Zagreb is the capital and the largest city of Croatia</div>
</div>
</a>
<a class="w-inline-block featured-male-slike karta" href="/zagreb/category/to-see/2/museum-of-broken-relationships/8">
<img class="featured-male-slike" src='/Content/3a6ee262-676f-4599-9f97-6b9c48136449.jpg' />
<div class="potpis-mala-slika-featured">
<div class="potpis-ispod-slike">Museum of Broken Relationships</div>
</div>
</a>
</div>
<div class="strelica-desno"> <img src='/Content/strelica-desno.svg' /> </div>
</div>
This would just change the order of the elements - 1st the left arrow, than the gallery, than the right arrow - so they're displayed next to each other. Guess this could be changed in another way, but this is the easiest approach withouth having to change too much in the CSS.
In the CSS
.featured-male-slike.karta
{
clear: right;
display: inline;
float: left;
margin-top: 30px;
overflow: hidden;
/* position: absolute; */ /* <--comment position abolute out */
}
comment "position: absolute;" out - you could also remove it, but it's better to keep it just so you can check with whomever created this slider for you, maybe there's some other way to fix the slider as you mentioned it should be working as it is. Because of this position:absolute the gallery would still be displayed above the left arrow, removing it has the purpose to keep the CSS-property float:left for all three elements - left arrow, gallery, right arrow, so they will be displayed next to each other.
Next is up to you - the images are displayed not positioned correctly because they have a different height, and the css for the img is height: auto, meaning that the height for each img depends on the actual calculated height (as both images are scaled down from bigger original images). You could either try to display images with the same size, or you can add css to set a fixed height for both images, e.g.
.slike-wrapper img
{
height:140px;
}
as the left image has a calculated height of 158px and the right image has 140px. As I only tested this directly in the browser's web developer tools, I can't guarantee that this approach would work for you, but you can give it a try.

How to have a button between a hr line - which then collapses elegantly

I would like a button between two hr elements with a bit of spacing wither side of the button and for this to remain the same when collapsing. I am using the Bootstrap framework.
I have got the current effect using the second answer from this question:
Add centered text to the middle of a <hr/>-like line
Therefore, my code is the same as what the answer provided. The first answer doesn't provide the spacing either side of the button.
Using media queries I am able to maintain the desired effect until I reach the 768px width break. Where this happens:
I can't continue to use media queries as I would have to apply them per pixel!
There must be an elegant solution to this? I'm assuming better use of columns and width percentages ?
Any help would be appreciated.
Using Bootstrap this solution should work fiddle:
<div class="container-fluid">
<div class="row">
<div class="col-xs-5">
<hr>
</div>
<div class="col-xs-2">
<a class="btn btn-md btn-primary">Add</a>
</div>
<div class="col-xs-5">
<hr>
</div>
</div>
</div>
You can use image for these lines by simply adding img tag:
CSS
img{
width:200px;
border:0;
height:10px;
background:url(http://goo.gl/bPZONP);
}
HTML
<div><img src="http://goo.gl/bPZONP">Button<img src="http://goo.gl/bPZONP"></div>
Demo
http://jsfiddle.net/qW6z9/