Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 8 of 8
Like Tree6Likes
  • 2 Post By Ronald Roe
  • 1 Post By TheGAME1264
  • 1 Post By Ronald Roe
  • 1 Post By TheGAME1264
  • 1 Post By Ronald Roe

Thread: center

  1. #1
    Senior Member
    Join Date
    Apr 2016
    Posts
    717
    Member #
    53891
    Liked
    11 times

    center

    I'm having a bit of trouble centering the image gallery I spoke about in the last thread, I can move it left or right x px but cant get it to center on the page, can anyone help? heres my code

    <!doctype html>
    <html lang="en">


    <head>

    <title>Pratts of Carlow Ltd</title>

    <link rel="stylesheet" href="../css/landing.css" />
    <link rel="stylesheet" href="../css/slider.css" />

    <meta http-equiv="x-ua-compatible" content="text/html" charset="utf-8">
    <meta name="description" content="Pratts of Carlow are an award winning, Family run Italian automobile specialist based in Carlow town">
    <meta name="keywords" content="">

    <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
    <script src="../javascript/slidereffects.js"> </script>
    <script src="../javascript/slider.js"> </script>

    <script>

    $(function(){
    var slider = new BeaverSlider({
    structure: {
    container: {
    id: "my-slider",
    width: 1200,
    height: 525
    }
    },
    content: {
    images: [
    "../images/124.jpg",
    "../images/500.jpg",
    "../images/tipohb.jpg",
    "../images/tiposw.jpg",
    "../images/500mpw.jpg",
    "../images/500x.jpg",
    "../images/doblo.jpg",
    "../images/talento.jpg",
    ]
    },
    animation: {
    effects: effectSets["slider: fade"],
    interval: 4000,
    initialInterval: 4000,
    waitAllImages: true

    }
    });
    });

    </script>

    </head>



    <body>

    <header>


    <div id="title">
    <h1> Pratts of Carlow Ltd </h1>
    <h6> <span id="one">Italian </span> <span id="two"> Automobile </span> <span id="three"> specialists </span></h6>
    </div>


    <div id="imgbox">
    <img src="../images/fiatlogo.png" />
    <img src="../images/fiatpro.png" width="90" height="76" />
    <img src="../images/alfaromeo.png" width="76" height="76" />
    <img src="../images/abarth.png" width="100" height="76" />
    </div>


    <img id="ribbon" src="../images/ribbon.jpg" height="25" width="100%" />


    <nav>
    </nav>


    </header>

    <main>
    <div id="my-slider"></div>
    </main>


    </body>


    </html>
    html {
    margin: 0 auto;
    }

    body{
    margin: 0 auto;
    position: relative;
    background-color: black;
    }

    header {
    position: relative;
    width: 100%;
    height: 125px;
    }


    #title {
    position: absolute;
    top: 16%;
    width: 350px;
    height: 50%;
    padding: 0;
    }
    h1 {
    position: absolute;
    left: 2%;
    padding: 0;
    margin: 0;
    top: 10%;
    color: white;
    font-family: helvetica, arial, sans-serif;
    font-weight: 300;
    text-shadow: 0px 0px 2px white;
    letter-spacing: 2px;
    font-style: italic;
    }

    #one {
    color: green;
    }

    #two {
    color: rgb(240,240,240);
    }


    #three {
    color: red;
    }

    h6 {
    position: absolute;
    left: 2%;
    top: 60%;
    padding: 0;
    margin: 0;
    font-family: helvetica, arial, sans-serif;
    color: white;
    letter-spacing: 5.5px;
    }

    #imgbox {
    position: absolute;
    width: 375px;
    margin: 10px;
    right: 0%;
    }

    #ribbon {
    position: absolute;
    top: 100px;
    }

    main{
    position: relative;
    width: 100%;
    height: 550px;
    text-align: center;
    margin: 0 auto;
    }
    #my-slider {position: absolute;
    margin: 0 auto;
    }

  2.  

  3. #2
    Senior Member
    Join Date
    Apr 2016
    Posts
    717
    Member #
    53891
    Liked
    11 times
    this is the css that comes with the slider

    /* usual control elements */
    .control-container {
    /* as far as controls are displayed as inline-block this puts them to center */
    /* choose left or right to put it to left/right */
    text-align: center;

    /* margin from the bottom of slider */
    /* see demo to learn how to put panel over the slider */
    margin-top: 10px;
    }

    .control-element, .control-element-active {
    /* this displays element as inline-block; zoom and *display is a hack for ie7 which does not support inline-block */
    display: inline-block;
    zoom: 1;
    *display: inline;

    /* change this to the values you need */
    width: 7px;
    height: 7px;
    background: #d7f1ab;
    margin: 0 5px;
    cursor: pointer;
    }

    .control-element-active {
    background: #819462;
    }

    /* usual control elements over slider */
    .control-container-over {
    /* fixes it on the top in the 3d world (the effects area of a slider has 100 by default) */
    position: relative;
    z-index: 101;

    /* put panel over the slider */
    margin: -35px 0 0 10px;

    /* put panel in the middle */
    /* margin: -30px auto; */

    background-color: rgba(215,241,171,0.6);
    padding: 3px 5px;

    /* change width to your value */
    width: 200px;
    }

    .control-element-over, .control-element-active-over {
    /* this displays element as inline-block; zoom and *display is a hack for ie7 which does not support inline-block */
    display: inline-block;
    zoom: 1;
    *display: inline;

    /* change this to the values you need */
    width: 10px;
    height: 10px;
    border-radius: 5px 5px 5px 5px;
    background: white;
    margin: 0 5px;
    cursor: pointer;
    }

    .control-element-active-over {
    background: #424242;
    }

    /* image-preview control elements */
    .control-container-img {
    /* as far as contorls are displayed as inline-block this puts them to center */
    /* choose left or right to put it to left/right */
    text-align: center;

    /* change this to the values you need */
    margin-top: 1px;
    overflow-x: scroll;
    overflow-y: hidden;
    white-space: nowrap;
    }

    .control-element-img, .control-element-active-img {
    /* this displays element as inline-block; zoom and *display is a hack for ie7 which does not support inline-block */
    display: inline-block;
    zoom: 1;
    *display: inline;

    /* change this to the values you need */
    width: 150px;
    height: 88px;
    margin: 0;
    cursor: pointer;
    opacity: 0.4;
    filter: alpha(opacity=40)
    }

    .control-element-img:hover {
    opacity: 0.7;
    filter: alpha(opacity=70)
    }

    .control-element-active-img {
    opacity: 1;
    filter: alpha(opacity=100)
    }

    .control-element-img img, .control-element-active-img img {
    width: 150px;
    height: 88px;
    }

    /* carousel player */
    .player-container-carousel {
    height: 132px;
    width: 720px;
    margin-top: 144px;
    }

    .player-back-carousel, .player-forward-carousel {
    background-image: url(carousel.png);
    height: 132px;
    width: 40px;
    float: left;
    opacity: 0.7;
    filter: alpha(opacity=70)
    }

    .player-forward-carousel {
    float: right;
    background-position: -47px;
    }

    .player-back-carousel:hover {
    background-position: -96px;
    opacity: 1;
    filter: alpha(opacity=100)
    }

    .player-forward-carousel:hover {
    background-position: -144px;
    opacity: 1;
    filter: alpha(opacity=100)
    }

    /* dummy for missing buttons to display the forward button in the same row */
    .player-pause-carousel, .player-play-carousel {
    /* this displays element as inline-block; zoom and *display is a hack for ie7 which does not support inline-block */
    display: inline-block;
    zoom: 1;
    *display: inline;
    }

    /* usual player with images */
    .player-container {
    height: 28px;
    white-space: nowrap;
    }

    .player-pause, .player-play, .player-forward, .player-back {
    /* this displays element as inline-block; zoom and *display is a hack for ie7 which does not support inline-block */
    display: inline-block;
    zoom: 1;
    *display: inline;

    cursor: pointer;
    margin-left: 5px;
    height: 28px;
    width: 33px;
    background-image: url(player.png);
    }

    .player-pause {
    background-position: -199px 0;
    width: 28px;
    }

    .player-pause:hover {
    background-position: -161px 0;
    }

    .player-play {
    background-position: -356px 0;
    width: 28px;
    }

    .player-play:hover {
    background-position: -319px 0;
    }

    .player-back {
    background-position: -275px 0;
    }

    .player-back:hover {
    background-position: -234px 0;
    }

    .player-forward {
    background-position: -434px 0;
    }

    .player-forward:hover {
    background-position: -393px 0;
    }

    /* usual player with text */
    .player-text-container {
    background-position: 0 0;
    color: white;
    height: 28px;
    width: 151px;
    font-family: PT Sans Narrow;
    font-size: 1.3em;
    background-image: url(player.png);
    }

    .player-text-container div {
    display: inline-block;
    font-size: 0.8em;
    margin: 0 10px;
    cursor: pointer;
    width: 29px;
    }

    .player-text-pause:hover, .player-text-play:hover, .player-text-forward:hover, .player-text-back:hover {
    text-decoration: underline;
    }

    /* messages */
    .message-container {
    background: #424242;
    color: white;
    font-size: 0.9em;
    font-family: PT Sans Narrow;
    padding: 5px;
    }

    /* events */
    #status-message {
    visibility: hidden;
    font-weight: bold;
    color: red;
    }

    /* widget */
    .widget-container {
    background: #424242;
    color: white;
    font-size: 0.9em;
    font-family: PT Sans Narrow;
    padding: 5px;
    }

    .widget-container td {
    padding: 2px 4px;
    }

    .widget-container input {
    width: 153px;
    }

    /* google maps */
    .maps-container {
    background: rgba(42,42,42,0.6);
    padding: 5px 5px 3px 5px;
    }

    .maps-container img {
    /* fixed size is needed for animation */
    width: 150px;
    height: 150px;
    }

  4. #3
    Senior Member
    Join Date
    Apr 2016
    Posts
    717
    Member #
    53891
    Liked
    11 times
    don't bother responding, I have scrapped this and now working on a simple fade in/out image gallery

  5. #4
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    The easy way to center something with a known width is to use calc() on the margin-left:

    Code:
    #imgbox{
      margin-left: calc(50% - (375 / 2)); /* I used your imgbox 375px width from above */
    }
    busso and TheGAME1264 like this.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  6. #5
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    You don't need the extra set of brackets. 375 / 2 = 187.5.
    busso likes this.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  7. #6
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    I was trying to show the process without having to spell it out.
    busso likes this.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  8. #7
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    No excuses! I say, no excuses!
    busso likes this.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  9. #8
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    Fine. I'll spell it all out from now on, but only on one condition - I get to end every sentence in "obs - fkn newb".
    busso likes this.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 11:59 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com