I am currently creating a PHP based Website which needs to list the Programmes... I tried creating a custom CSS code by myself, tried breaking templates to get the CSS. But everything failed. So could somebody help me get the CSS code for a div which look like the one given below
I would add the classes for buttons and other icons by myselves. I just want the div which is also reponsive. I am not much expert in CSS. I only want the alignment. Not the fancy elements inside it.
I have made fiddle here please check this out, hope you can edit the fiddle based on your needs
HTML
<div class='customHeight'>
<div class='row'>
<div class='col-sm-6 custom'>
<div class='dateHolder'>27 Nov</div>
</div>
<div class='col-sm-6'>
<div class='row '>
<h3>Some title goes here</h3>
</div>
<div class="row bottomGap">location / date goes here</div>
<div class="row bottomGap">Content goes here Content goes here
Content goes here Content goes here Content goes here Content goes
here Content goes here Content goes here Content goes here</div>
<div class='row'>
<button class="btn btn-default">
Buy Tickets
<button>
<button class="btn btn-danger">
Buy Tickets
<button>
</div>
</div>
</div>
CSS :
*
.bottomGap{
margin-bottom:5px;
}
.custom {
background-color: #ccc;
height:200px;
}
.customHeight{
height:200px;
}
.dateHolder{
height:80px;
width:50px;
background-color:#000;
padding-top:10px;
padding-left:10px;
}
*
How about something like this:
* { box-sizing: border-box }
.c {
height: 150px;
width: 500px;
background-color:#eee;
margin: 5px;
padding: 10px;
}
.c:after {
content: " ";
visibility: hidden;
display: block;
height: 0;
clear: both;
}
.c > div {
padding: 5px;
height:100%;
}
.c > div:first-child {
float:left;
width: 30%;
background-color:#aaa;
margin:0 0 0 0;
}
.c > div:last-child {
float:left;
width: 70%;
background-color:#ddd;
}
<div class="c">
<div>left</div>
<div>right</div>
</div>
Related
This is my attempt but the div wrapper doesn't center the content div.
I have a div containing ang box shape with another div with texts.
.wrapper {
position:absolute;
left: 50%;
}
.content {
width:90%;
text-align:justify;
left: -50%;
display: inline-block;
}
.button {
text-align:center;
}
<div class="wrapper">
<div name="box" style="background-color:#FF6201;width:220px;height:220px;:30px">
<div class="content">Content and Creative Writing, Social Media Management, SEO, Outbound Sales, Outbound Sales Appointment Setting,<button class="button">
weee</button>
</div>
</div>
</div>
I can actually do on html by adding tags but i am hoping to make this done in css. pls help.
I found this nifty trick a while back:
margin-left: 50%;
transform: translate(-50%)
This will center any statically positioned Div. I am assuming that you want the box centered; if so I would move the class="content" to that element and then revise your css to the following:
.content {
width:90%;
margin-left: 50%;
text-align:justify;
transform: translate(-50%)
}
Here is a fiddle link to see if this is what you were going for: https://jsfiddle.net/e3tsj8qf/5/
Edit:
Code from fiddle referenced below (accepted as answer):
.box {
background-color:#FF6201;
width:220px;
height:220px;
}
.content {
width:90%;
text-align:justify;
margin-left: 5%;
}
.centered {
text-align:center;
}
<div class="box" name="box">
<div class="content">
Content and Creative Writing, Social Media Management, SEO, Outbound Sales, Outbound Sales Appointment Setting,
</div>
<div class="centered">
<button class="button">weee</button>
</div>
</div>
Try this code markup and style.....
*{box-sizing:border-box};
*{margin:0;padding:0}
.wrapper {
position: absolute;
left: 50%;
transform:translate(-50%);
}
.content {
width: 85%;
text-align: center;
display: block;
margin:0 auto;
}
.button {
text-align: center;
}
<div class="wrapper">
<div name="box" style="background-color:#FF6201;width:220px;height:220px;">
<div class="content">Content and Creative Writing, Social Media Management, SEO, Outbound Sales, Outbound Sales Appointment Setting,<button class="button">
weee</button>
</div>
</div>
</div>
Hello I am just making a base template to help me make a website a lot better, I have just recently started using bootstrap and have noticed that when I resize my browser (for example to a mobile size) it is overlapping on my footer?
Does anyone know why this is happening?
Here are some images of when I add more text or resize:
Like I say I am fairly new to bootstrap and am most likely doing something really stupid which is easy to fix :)
Here is my css:
html, body { height:100% }
nav {
margin: 0;
padding: 0;
}
div {
display: block;
}
.col-centered {
float: none;
margin: 0 auto;
}
.center {
margin-left:auto;
margin-right:auto;
margin: 0 auto;
}
.left {
float: left;
}
.right {
float: right;
}
.container {
width: 100%;
margin: 0;
padding: 0;
height:100%;
background:red;
}
.content {
padding: 5rem 1.5rem;
text-align: left;
height:90%;
width:75%;
margin:0 auto;
background: green;
}
footer {
background: grey;
height:10%;
width:75%;
margin:0 auto;
}
Here is my main HTML:
<div class="container">
<div class="content">
<div class="row">
<div class="col-md-auto col-centered">
<h1>Base Template Title</h1>
<p>Text would go here...</p>
</div>
</div>
</div>
<?php include "footer.php" ?>
EDIT: I forgot to include the footer, if you think that I need to add this for you then please let me know.
Thank you very much for even looking at this post!
EDIT 2:
Here is the code for my footer:
<footer>
<div class="row">
<div class="col-md-auto">
<p class="float-right">Back to top</p>
<p>© 2017 Company, Inc. · Privacy · Terms</p>
</div>
</div>
</footer>
Here is the link to the website:
http://81.131.193.35/
Remove the height of .content
.content {
padding: 5rem 1.5rem;
text-align: left;
width: 75%;
margin: 0 auto;
background: green;
}
and also remove the height of .container
.container {
width: 100%;
margin: 0;
padding: 0;
background: red;
}
I would wrap the footer.php in a pair of divs and apply a row and col-md-auto class to it. It looks like the footer is maybe styled with an absolute or even a static display. This is making the footer not play along with the other divs
<div class="container">
<div class="content">
<div class="row">
<div class="col-md-auto col-centered">
<h1>Base Template Title</h1>
<p>Text would go here...</p>
</div>
</div>
</div>
<div class="row">
<div class="col-md-auto">
<?php include "footer.php" ?>
</div>
</div>
</div>
I'm making a web site responsive, and on the home page I should insert two "containers" that should be centered and aligned. (containers in this case are two divs with inside images and text)
I wish they would behave in this way
and when the page is "restricted", the two divs should position itself in this way
I tried like this, but it is not exactly what I would get
<div style="">
<div style="width: 300px;float: left;">
div 1
</div>
<div style="width: 300px;float: left;">
div 2
</div>
</div>
I'd try to use display: inline-block property. In this way you don't have to apply 'overflow' for parent and it's pretty easy to make blocks centered.
HTML:
<div class="wrapper">
<div class="box">Div 1</div>
<div class="box">Div 2</div>
</div>
CSS:
.wrapper {
text-align: center;
/* Just decoration */
border: 1px solid blue;
padding: 20px;
}
.wrapper .box {
display: inline-block;
width: 300px;
height: 50px;
/* Just decoration */
border: 1px solid green;
}
Take a look at the fiddle http://jsfiddle.net/caprella/y4BQ3/
I put something quick together for you. You will have to use media queries to find the size of the page when you want the style to switch. Mess around with my example and you should be able to figure something out to your liking.
<div id="box">
<div class="innerBox">
div 1
</div>
<div class="innerBox">
div 2
</div>
<div class="clear"></div>
</div>
And the CSS...
#box {
width:88%;
background:red;
padding:20px 6%;
}
.clear{clear:both}
.innerBox {
width:41%;
float:left;
background:blue;
display:block;
}
.innerBox:first-child {
margin-right:18%;
}
#media screen and (max-width: 400px) {
#box .innerBox {
float:none;
width:100%;
margin:20px 0 0 0;
}
#box .innerBox:first-child {
margin-top:0;
}
}
}
JsFIddle link: http://jsfiddle.net/x3JLX/
Check out this Fiddle. There's only a few simple changes to your existing code, which I included below.
http://jsfiddle.net/ArKKG/
<div style="overflow:auto; height: 100% text-align: center;">
<div style="width: 300px; height: 50px;float: left;">
div 1
</div>
<div style="width: 300px;height: 50px;float: left;">
div 2
</div>
</div>
And some CSS to make them visible, and keep the borders separated.
div{
border: 1px solid black;
margin: 4px;
}
I am adding an image in HTML which is the title for the page. When I add it, it overlaps the rest of the content that comes after that. I need the rest of the content to adapt accordingly. Not sure how to do this.
My code looks like this:
HTML:
<div class="page_book"><div class="book_wrapper"><div class="book_content"> <!-- start description for page 1-->
<div class="title"><img src="img/soho_page1_image_0.png" alt="Introduction" width="30" height="50"></div>
<img src="pages/page_1.jpg" />
<p>This content.</p>
</p>
</div></div></div><!-- end description for page 1-->
<div class="meta">
<span class="num">1</span>
</div>
<div class="gradient"></div><div class="loader"></div>
</div>
CSS:
.title
{
position:absolute;
left: 20px;
}
.page_book img {
width: 70%;
margin: 10px auto;
display: block;
cursor: pointer;
}
.page_book p {
line-height: 20px;
}
I tried removing the .title class but the image covers the whole width.
Try:
.title
{
position:relative;
margin-left: 20px;
}
Also, use
.title img{
margin:0px;
width:auto;
}
The image currently inherits the styles of .page_book img and that's what's causing all the mess..
Next time adding a jsFiddle to the question would be helpful
I have a client who wants a particular design on their home page to match what is seen on their magazine cover. The basic stairstep design of the cover never changes but occasionally the images do. I have not been able to devise a way to cover this format without using 1 large image.
Here's a fiddle: http://jsfiddle.net/z6ghY/
Note: The appearance in this fiddle is correct in how the client wants it to be seen. My problem is that it uses one large image that must be changed occasionally. It would be much easier if these three images were separated.
Anyone know the best way I can achieve this? The images can be placed via HTML or CSS, either way does not matter, though it would be nice to see them in the HTML for SEO benefits.
In case the fiddle doesn't display the image here it is.. http://i.imgur.com/6s2i9L7.png
HTML:
<h2>Innovative Engineering Solutions in Material Handling</h2>
<div class="home-container">
<div class="home-content"><p>Experience the impact that Lauyans & Company can make on your business success. Through innovative engineering solutions in material handling, Lauyans will take responsibility for the planning, execution and acceptance of your project.</p>
<!--h2>Lauyans... why choose anyone else?</h2-->
<h2 style="margin: 80px 0 0 30px;">Lauyans...<br /> why choose<br /> anyone else?</h2>
</div><!-- END HOME CONTENT -->
</div><!-- END HOME CONTAINER -->
<div class="home-container2">
<div class="home-planning">
<h3>Planning</h3>
</div>
<div class="home-execution">
<h3>Execution</h3>
</div>
<div class="home-acceptance">
<h3>Acceptance</h3>
</div>
</div>
CSS:
.home-container { width: 690px; height: 459px; background: url('/wp-content/uploads/2013/01/home-image.png') 50% 100% no-repeat; }
.home-container2 { width: 690px; }
.home-content { width: 430px; height: 429px; padding: 15px; }
.home-content p { padding: 0; margin: 0; }
.home-content h2 { padding-top: 10px; margin: 0; }
.home-container2 h3 { padding-top: 0px; margin: 0; text-align: center; }
.home-planning { width: 230px; float: left; }
.home-execution { width: 230px; float: left; }
.home-acceptance { width: 230px; float: left; }
I would take the absolute positioning route considering the "unique" layout you are going for:
http://jsfiddle.net/z6ghY/1/
I reworked everything (including the images which I had to grab from somewhere else):
HTML
<div class="home_con">
<h2 class="pge_title">Innovative Kitten Solutions</h2>
<div class="home_step">
<h2 class="step-title">Lauyans...<br /> why choose<br /> anyone else?</h2>
<p>
Experience the impact that Kittens can make on your business success through
purring.
</p>
<img class="img1" src="http://www.vivapets.com/img/album/52/19052_white_persian_kittens_for_adoption_thb.jpg" />
<img class="img2" src="http://www.saudivets.com/images/Vpic20.jpg" />
<img class="img3" src="http://fc04.deviantart.net/fs70/f/2011/167/2/8/kitten_tracks_banner_100x300_by_xxjessie_kittehxx-d3j2h51.png" />
</div>
<div class="img_text">
<div class="img_text_ele">Planning</div>
<div class="img_text_ele">Execution</div>
<div class="img_text_ele">Acceptance</div>
</div>
</div>
CSS
.home_con h2.pge_title { font-weight:bold; font-size:1.125em; }
.home_step { width:300px; height:300px; position:relative; }
.home_step h2.step-title { position:absolute; top:110px; left:10px; }
.home_step p { width:200px; position:absolute; top:10px; left:10px; }
.home_step img { position:absolute; bottom:0px; }
.home_step .img1 { left;0px; }
.home_step .img2 { left:100px; }
.home_step .img3 { left:200px; }
.home_con .img_text { width:300px; overflow:hidden; }
.home_con .img_text_ele { width:100px; float:left; text-align:center; }
This way would need the images to be chopped up a bit but it would work if that was cool to do:
http://jsfiddle.net/5qfLj/1/
HTML:
<div class="container">
<div class="row">
<div class="span2">1</div>
<div class="span1" style="background:#ccc;">2</div>
</div>
<div class="row">
<div class="span1">3</div>
<div class="span1" style="background:#666;">4</div>
<div class="span1" style="background:#ccc;"></div>
</div>
<div class="row">
<div class="span1" style="background:#999;">5</div>
<div class="span1" style="background:#666;">6</div>
<div class="span1" style="background:#ccc;">7</div>
</div>
</div>
CSS:
.container {
width:600px;
}
.row {
overflow: hidden;
}
.span1 {
float:left;
width:200px;
height:200px;
}
.span2 {
width:400px;
height:200px;
float:left;
}